Results 1 to 1 of 1

Thread: The Hotaru Cycle

  1. #1
    Former lead dev Nick's Avatar
    Join Date
    Jun 2009
    Location
    Kakamigahara, Japan
    Posts
    2,915
    Blog Entries
    88
    Thanks
    519
    Thanked 845 Times in 550 Posts

    Default The Hotaru Cycle

    Here's a brief explanation of how Hotaru works:

    The Hotaru Cycle:

    Core index → Theme index → Display template → user action → Core index

    What happens at each stage?

    Core index

    There are 2 entry points in Hotaru, index.php and admin_index.php. Everything goes through one of those files. Let's look at them:

    PHP Code:
    <?php
    // includes
    require_once('hotaru_settings.php');
    require_once(
    'Hotaru.php');
    $h = new Hotaru();
    $h->start('main'); // or "admin" in admin_index.php
    ?>
    That's it. The settings file is included first and a new $h (Hotaru) object is constructed. The constructor and start method in Hotaru.php* sets up everything and finally displays the index template from your theme folder.

    * The Hotaru class is the engine of your site. It includes a number of files such as class libraries, utility files and third party extensions. It initializes the database and pulls in the settings stored in the database. It sets up Inspekt for input filtering and validation and then checks for a cookie so users can log in. The bulk of Hotaru.php is used for shortcuts to most of the functions in other classes.

    Theme index


    The index.php template file in your theme folder is the skeleton for how your pages are displayed. It includes a header, sidebar and footer. Each section pulls in a relevant template or is otherwise overridden by plugins**, e.g.

    PHP Code:
    <!-- SIDEBAR -->
    <?php
         
    // plugin hook
         
    $result $h->pluginHook('theme_index_sidebar');
         if (!
    $result) {
             
    $h->displayTemplate('sidebar');
         }                                
    ?>
    Full details on the index.php template can be found here.

    ** This is where the magic happens. Plugins check for parameters passed via links or forms and determine the content to display based on those parameters. If there are no plugins, Hotaru will simply display an empty template.

    Display template

    The index template is displayed, containing a combination of different templates, e.g. sidebar.php.

    User action

    When a user clicks a link or submits a form, Hotaru returns to the beginning of the cycle and rebuilds the page depending on the parameters passed by the link clicked or the form submitted.
    Last edited by Nick; 01-06-2010 at 02:35 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •