Difference between revisions of "Addons:Page"

From GExtension Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 23: Line 23:
 
After creating a page, it is available under index.php?t=<rawname>. <rawname> is the name of the file without ".php".
 
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:
+
You may want to allow a common page for all groups. Run this command in your install.php:
 
  Permissions::AllowPagesForEveryone($rawname1, $rawname2, ...);
 
  Permissions::AllowPagesForEveryone($rawname1, $rawname2, ...);
  
 
Check out existing pages for examples.
 
Check out existing pages for examples.
 +
 +
 +
[[Category:Addons]]

Latest revision as of 14:27, 16 January 2018

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. Run this command in your install.php:

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

Check out existing pages for examples.