Results 1 to 7 of 7
  1. #1
    Junior Member davejmason's Avatar
    Joined
    Mar 2012
    Posts
    16
    Thanks
    Received:0
    Given: 0

    How to set modules only to appear in specific categories?

    Hi folks, thought I'd better separate this question from my other topic.

    I'm editing another module to create something that will display a simple facebook facepile in the sidebar. I actually have a number of different facebook pages so I would like to have each specific facebook page's facepile only appear on the relevant Pligg categories. ie having the Drummer's facebook page showing it's facepile on the Pligg "drums" category. Hopefully this makes sense!

    I noticed this part of code in the module that will allow me to set which specific pages the module would appear on but what I'm after is that it only displays when viewing one specific category.

    Also, is it wise to create separate individual facepile modules for each post category like this or would there be a simpler way of doing it all within a single one?

    PHP Code:
    <?php
        
    include_once('sidebar_facepile_settings.php');

        
    // tell pligg what pages this modules should be included in
        // pages are <script name> minus .php
        // index.php becomes 'index' and upcoming.php becomes 'upcoming'
        
    $do_not_include_in_pages = array();
        
        
    $include_in_pages = array('all');
        if( 
    do_we_load_module() ) {        
            if(
    is_object($main_smarty)){
                
    $main_smarty->plugins_dir[] = sidebar_facepile_plugins_path;

                
    module_add_action_tpl('tpl_pligg_sidebar_start'sidebar_facepile_tpl_path 'sidebar_facepile_index.tpl');
                            
    module_add_action_tpl('tpl_pligg_story_tools_end'sidebar_facepile_tpl_path 'sidebar_facepile_link.tpl');
            }
            
    // module_add_action_tpl('tpl_pligg_below_center', sidebar_facepile_tpl_path . '<your tpl name>.tpl');
        
    }
    ?>
    Thanks for your time. And please excuse my ignorance! I'm trying to learn all this as I go

    D

  2. #2
    Junior Member davejmason's Avatar
    Joined
    Mar 2012
    Posts
    16
    Thanks
    Received:0
    Given: 0
    Any ideas folks? Sorry to bump!

  3. #3
    Member xplosive0012's Avatar
    Joined
    Mar 2011
    Posts
    89
    Thanks
    Received:6
    Given: 5
    This should help buddy! Category Templating

    This code will display the word "Test" on the "Tech News" category page on my example site:
    {if $request_category eq "Tech-News"}Test{/if}
    This code will display the word "Test" on the "Tech News" AND "World News" categories on my example site:
    {if $request_category eq "Tech-News" || $request_category eq "World-News"}Test{/if}
    Replace 'Test' with your own code. Replace 'Tech-News' with your category.

  4. #4
    Junior Member davejmason's Avatar
    Joined
    Mar 2012
    Posts
    16
    Thanks
    Received:0
    Given: 0
    Awesome! That's sorted it. Thanks xplosive, much appreciated

  5. #5
    Junior Member davejmason's Avatar
    Joined
    Mar 2012
    Posts
    16
    Thanks
    Received:0
    Given: 0
    Actually, one final thing, how would I set something to only appear on the homepage but not in any categories?

  6. #6
    Pligg Founder/Coder/Designer Yankidank's Avatar
    Joined
    Dec 2005
    Location
    San Francisco, CA
    Posts
    5,514
    Thanks
    Received:87
    Given: 14
    Site
    http://pligg.com/demo/
    Code:
    {if $pagename == 'index' && count($templatelite.get) == 0} 
       Homepage Content 
    {/if}


    Other $pagename tricks here.
    The Facebook Module for Pligg CMS!
    Register, Login, and Submit Stories with Facebook. An absolute MUST HAVE for all Pligg sites!

  7. #7
    Junior Member davejmason's Avatar
    Joined
    Mar 2012
    Posts
    16
    Thanks
    Received:0
    Given: 0
    Awesome, thanks Yankidank. It's worked.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Web Hosting Services by Midphase Dreamhost Web Hosting Donate to Pligg