GiriGiriPHP
home | about | download | how to


Flattr this
How to add a page
pages menu in adminstration
You will find the pages administration in the admin page of GiriGiri.

To add your page, fill in the name for the page, and click add

Say, 'new_page'. The name needs to be alphanumeric with no spaces. This will add the page. Now, that page can be requested by sending the page request in any request string, GET or POST, like

?page=new_page

or

?page=new_page&somemorerequeststringshere

Next, drop a template for the page you added

By going to the template folder you are using ... This folder is under templates/ folder of the GiriGiri installation. The default template is under the directory 'default'. You should go to the directory of whatever template you are using.

When you are at the correct directory, create a file with the name 'new_page.tpl'. It may be empty, or it may contain any kind of html, javascript, form, text you want that page to show at all times by default, in addition to whatever output the modules may produce for that page.

Now you can assign module-actions to that page.

To do this, select the page from the page selector in pages section of admin menu, by choosing 'Modify module/actions'. Then, at the resulting page, the selected page will be shown, and you will be asked to pick a module. Say, you choose user module and submit

Now the page will show selected page as new_page, and selected module as user. And it will show a selection of actions available for that module, and a box to enter the sort order.

Say, select 'register', and give a sort value of 0. Then save. This will add the action 'register' from module 'user' to the page 'new_page', with sort order 0. Since the register action in user module is set to display a registration form, when a user requests this page, without any actions, the page will print out a registration form.

Then, this time, select 'edit_self' action, and add it with sort order 1. This will add 'edit_self' action from user module to the page 'new_page', in addition to what was there from before. Since edit_self action in user module is coded to print out a profile editing form, it will attempt to print out the profile edit form for users.

Now, when that page is requested, the system will both attempt to print out the registration form and edit_self forms, however, since the action 'register' is only allowed for anonymous users, and the action 'edit_self' is only allowed for registered users and admins, it will show the registration form to the anonymous user, and skip running the 'edit_self' action. For the registered user and admin, it will do the opposite.

This example should illustrate the versatility of mapping module-actions to pages, and what can be done with that kind of mapping. Its up to your imagination.

For permission settings, refer to 'adding an action' part of the how tos.