Results 1 to 2 of 2

Thread: Tip: You don't need a sidebar template

  1. #1
    Former lead dev Nick's Avatar
    Join Date
    Jun 2009
    Location
    Kakamigahara, Japan
    Posts
    2,859
    Blog Entries
    88
    Thanks
    482
    Thanked 808 Times in 527 Posts

    Default Tip: You don't need a sidebar template

    How can you have a sidebar without a sidebar template? Easy!

    In the default theme, you've got this:

    index.php
    PHP Code:
                                <!-- SIDEBAR -->
                                <?php
                                    
    // plugin hook
                                    
    $result $h->pluginHook('theme_index_sidebar');
                                    if (!
    $result) {
                                        
    $h->displayTemplate('sidebar');
                                    }                                
                                
    ?>
    sidebar.php

    PHP Code:
    <div id="sidebar">

        <?php $h->pluginHook('widget_block''', array(1)); ?>

    </div>
    So you could just move the sidebar code into your index template and delete the sidebar template altogether!

    index.php
    PHP Code:
                                <!-- SIDEBAR -->
                                <?php
                                    
    // plugin hook
                                    
    $result $h->pluginHook('theme_index_sidebar');
                                    if (!
    $result) { ?>
                                        <div id="sidebar">
                                            <?php $h->pluginHook('widget_block''', array(1)); ?>
                                        </div>
                                <?php ?>

  2. #2
    Member Jason's Avatar
    Join Date
    Jul 2009
    Location
    Nagoya, Aichi
    Posts
    74
    Thanks
    3
    Thanked 15 Times in 10 Posts

    Default

    This is similar to how it's done in SMF, too. It's nice that we can do something like this in Hotaru as it will make minimalist themes consist of maybe ... 3 files?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Tip: You don't need a 404error template
    By Nick in forum How-To and Troubleshooting
    Replies: 0
    Last Post: 01-19-2010, 05:56 AM
  2. Replies: 6
    Last Post: 12-02-2009, 06:37 PM
  3. [Docs] Including Template, Language, JavaScript and CSS Files in a Plugin
    By Nick in forum Developing Plugins
    Replies: 1
    Last Post: 09-24-2009, 06:36 AM
  4. [Docs] How to Add Another Sidebar
    By Nick in forum Design and Layout
    Replies: 0
    Last Post: 08-08-2009, 02:45 PM
  5. Template for Plugin Description
    By Nick in forum Plugin Downloads
    Replies: 1
    Last Post: 07-18-2009, 02:27 AM

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
  •