Hotaru Docs

 [həʊdɒks]

Getting the Page Name

In most cases, Hotaru uses specific templates for each page, so you can edit them directly without having to use conditions to see which page you're looking at. However, some pages are multi-purpose so you'll need to test for the page name in order to customize it.

One of the first things Hotaru does is check to see if there's a "page" parameter in the url, or submitted from a form. If so, this value is assigned to...

$h->pageName

If you'd like get the page name yourself, you can get it directly using:

$page = $h->cage->get->testPage('page'); // from the url
$page = $h->cage->post->testPage('page'); // from a form

Or, you can just do this:

$page = $h->getPageName(); // this is what Hotaru did to get $h->pageName;

In most cases, you'll simply want to check the current page name, which you can do like this:

if ($h->pageName == 'contact') { echo "This is the contact page."; }

If you'd like to display a message on the home page, try:

if ($h->pageName == $h->home) { echo "This is the home page."; }

Some plugins, like Bookmarking, don't have a "unique" homepage, i.e. $h->home = "popular" which is used by categories and tags, too. That's why Hotaru 1.4.0 introduced a way of getting the true homepage:

if ($h->isHome()) { echo "This is the home page."; }

Sometimes, you need more information than just the page name, so Hotaru provides a few extra properties which are filled by various plugins. They are:

$h->home // The name of the home page, e.g. popular
$h->pageName // e.g. popular, latest, upcoming, all, profile, submit2, comments
$h->subPage // e.g. filtered to category, tags, user
$h->pageType // e.g. list, post, user, submit
$h->pageTitle // e.g. Top Stories, User Profile, Latest Comments
$h->pageTemplate // e.g. sb_list, tag_cloud, users_profile

Here's an example of values if you're looking at the latest posts in a "News" category:

echo $h->pageName; // latest
echo $h->subPage; // category
echo $h->pageType; // list
echo $h->pageTitle; // News
echo $h->pageTemplate; // sb_list

If and how these properties are used is determined by individual plugins.

Getting StartedDesign and LayoutPlugin DevelopmentAdvanced TopicsFunction ReferenceTroubleshooting