Difference between revisions of "Addons:Page"

From GExtension Wiki
Jump to navigation Jump to search
Line 27: Line 27:
  
 
Check out existing pages for examples.
 
Check out existing pages for examples.
 +
 +
 +
[[Category:Addons]]

Revision as of 09:27, 21 May 2017

The pages section represents all pages a user could be able to visit. The filename should be <rawname>.php, where <rawname> is a lowercase identifiert. Pages for administrative purposes should begin with "admin_".

The first line of a page PHP file should always be the following:

<!--{"language":"<language-identifier>","icon":"<fontawesome-icon>","place":"<main|help|admin|user|none>","position":<position>}-->

Example:

<!--{"language":"search","icon":"fa-search","place":"main","position":40,"nologin":true}-->

Additionally is it possible to add the "nonlogin" paramter, to define that a page can be used without being logged in. See FontAwesome for icons.

Security Check

To verify that the file was included by GExtension, it's required to include the following code after the first line:

<?php 
	if(!isset($G_MAIN)){
		die(json_encode(array("error" => "authentification failed")));
	}
?>

Other

After creating a page, it is available under index.php?t=<rawname>. <rawname> is the name of the file without ".php".

You may want to allow a common page for all groups:

Permissions::AllowPagesForEveryone($rawname1, $rawname2, ...);

Check out existing pages for examples.