11
snow77
Re: How can I add a page
  • 2006/8/3 22:28

  • snow77

  • Just can't stay away

  • Posts: 864

  • Since: 2003/7/23



12
Daigoro
Re: How can I add a page
  • 2006/8/3 22:51

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


If you want to use the XOOPS system to manage your own pages, then you need to make a module for it.

The VERY SIMPLE way to make a module and to show your own html or php code, is to to the following (change to fit your needs):

This code will add one page and three sub-pages with your own html or php contents.

1) Create a directory named "example" in /modules.

2) Create a directory named "images" in the /example directory.

3) Put a small picture named "example.jpg" into the /images directory. It will be used as your modules icon in the XOOPS administration.

4) Then create a file named xoops_version.php inside the /example directory, with the following contents:
$modversion['name'] = "example";
$modversion['version'] = 0.01;
$modversion['description'] = "This is just an example";
$modversion['author'] = "Daigoro";
$modversion['credits'] = "";
$modversion['help'] = "";
$modversion['license'] = "GPL";
$modversion['official'] = 0;
$modversion['image'] = "images/example.jpg";
$modversion['dirname'] = "example";

// Admin things
$modversion['hasAdmin'] = 0;

// Menu
$modversion['hasMain'] = 1;
$modversion['sub'][1]['name'] = "Page1";
$modversion['sub'][1]['url']  = "Page1.php";
$modversion['sub'][2]['name'] = "Page2";
$modversion['sub'][2]['url']  = "Page2.php";
$modversion['sub'][3]['name'] = "Page3";
$modversion['sub'][3]['url']  = "Page3.php";
?>


5) Create index.php, Page1.php, Page2.php and Page3.php also inside the /example directory and put in the following contents:

require('../../mainfile.php');
require(
XOOPS_ROOT_PATH.'/header.php');

if (!
is_object($xoopsUser)) {
    
redirect_header('../../index.php'3"Please login to access this page");
    exit();
}

// Here you can fill in your own php code

?>



require(XOOPS_ROOT_PATH.'/footer.php');
?>



You need to install the module, just like any other modules.

I hope this helps you.
Best regards,
Daigoro

13
tarkhorani
Re: How can I add a page
  • 2006/8/4 19:33

  • tarkhorani

  • Just popping in

  • Posts: 8

  • Since: 2006/8/3 1


Thank you Daigoro

but i get thie error when want to install:

Module File for example Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!

14
tarkhorani
Re: How can I add a page
  • 2006/8/4 19:40

  • tarkhorani

  • Just popping in

  • Posts: 8

  • Since: 2006/8/3 1


ok solved

but cant see the module icon in right of admin panel.
do you know where is the problem?

15
Daigoro
Re: How can I add a page
  • 2006/8/4 21:41

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Tarkhorani,

It's nice to know you got it to install.
Why did you get the error?

Did you also manage to insert your own html and/or php code?

Quote:

but cant see the module icon in right of admin panel.
do you know where is the problem?


Hmm. Do you mean the icon list to the left in the admin page?
If yes, then it's simply beacuse there are no admin section in this kind of module.
If not, then please describe the problem further.
Best regards,
Daigoro

16
tarkhorani
Re: How can I add a page
  • 2006/8/5 8:18

  • tarkhorani

  • Just popping in

  • Posts: 8

  • Since: 2006/8/3 1


Thank you

where can I see my pages, where is the links.
why it has not admin icon so click on it and make a new page?

17
Daigoro
Re: How can I add a page
  • 2006/8/5 8:42

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


tarkhorani,


Quote:

where can I see my pages, where is the links.


If you have set up the group-access, then it should appear in the normal main menu. You should see one entry named "example", and when you click on it, the three sub-pages should appear.

If you have not put any of your own html or php into the files, then you will see empty pages, but the menu-entries will still be there.

Quote:

why it has not admin icon so click on it and make a new page?


You asked for a way to make a module where you could put in your own php code.
This is it, and it allows for both html and php code.
You will have to edit the files manualy to add new contents.
And you can add new pages by making new files and linking to them from the xoops_version.php file.
Adding an admin page would require much more code.
And security wise, too. If you relyed on putting php code into the admin page, and you made some wrong code, then it may be difficult (even impossible) to gain access to the code, to correct the error.
So you must have filesystem access, and edit the files manually.
Best regards,
Daigoro

Login

Who's Online

327 user(s) are online (249 user(s) are browsing Support Forums)


Members: 0


Guests: 327


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits