Special pages

Creating special pages is extremely easy to do in Enano. Just call register_special_page() at the session_started hook. Then create a function named according to the pattern page_Special_Foo and echo as you please from there.

The function register_special_page() takes three parameters:

  • The URL name of the special page. Uppercase and lowercase, letters and numbers only.
  • The name of the special page
  • (Optional) A Boolean switch that, if true (the default), will include the page in searches. If you only use your special page for internal functions, set this to false.

Example

<?php
$plugins->attachHook('session_started', 'myplugin_add_special();');
 
function myplugin_add_special()
{
  register_special_page('Example', 'Example special page', true);
}
 
function page_Special_Example()
{
  global $output;
 
  $output->header();
  echo '<p>It works!</p>';
  $output->footer();
}

Localized titles

If your special page's title (the second parameter to register_special_page()) is in the format of a language string (see Localization), it will be put through $lang->get() automatically.

Categories: (Uncategorized)