Pet Home Page

The pet Home Page extension adds the ability to assign a node to provide the content for a home page.

pet_home_page.class provides the basic code used in page creation. pet.class creates an object from pet_home_page.class and the theme gets the object to create the home page content.

Assume your theme is named example, the theme could contain something as simple as the following code.
function example_page($content)
{
global $pet;
$output .= $pet->home_page()->get_content();
}
?>

If you want your code to perform other things when you are on the home page, you can add the following if() test and then add other actions within the condition or within an else section.
if($pet->is_home_page())
{
// Insert other stuff here
$output .= $pet->home_page()->get_content();
// or here
}
else
{
// or here if you want the action on every page except the home page.
}
?>

You install pet_home_page as part of the pet module. Changes occur immediately because pet updates Drupal's variable table. The variable update creates a new entry in the cache table and the cache entry is read every time a visitor reads a Web page.

If you get any problems with pet_home_page, turn off the home page option in administer > pet and test the rest of pet. After you are happy that pet is working, turn home page back on and test the home page. I am happy to fix any problem I can reproduce on one of my sites.

Install

  1. Install pet first and test pet. pet_home_page uses pet.
  2. Download the following files. If your browser does not give you the option to save the files then try clicking the right mouse button.
  3. Save both files in to your modules/pet/ directory. pet will automatically detect pet_home_page.
  4. Visit administer > pet and switch on the home page option.
  5. Visit administer > pet > home page to select the home page.