Changing Plugins depending on themes

Creating and modifying plugins.
Post Reply
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Changing Plugins depending on themes

Post by Ianardo »

Is it possible to have a plugin appear only in a specific theme?
In the example below (Keyline_2) the menu is shown as tabs in the top section but when you switch themes (to Keyline) you don't have a menu.
I want to add an html nugget with a menu in it but I don't want it to appear on the first theme.
http://keylinelicensing.toondesign.biz/lobby/]Example
Any suggestions?

Cheers
Ian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Changing Plugins depending on themes

Post by garvinhicking »

Yes, you can do that.

For that you need to put a sidebar.tpl into the theme that should not show the sidebar plugin. You will see this code in it (excerpt):

Code: Select all

{foreach from=$plugindata item=item}
    <div class="serendipitySideBarItem container_{$item.class}">
        {if $item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}">{$item.title}</h3>{/if}
        <div class="serendipitySideBarContent">{$item.content}</div>
    </div>
{/foreach}
Now you can modify that to skip the HTML nugget:

Code: Select all

{foreach from=$plugindata item=item}
{if $item.title != 'Menu Nugget'}
    <div class="serendipitySideBarItem container_{$item.class}">
        {if $item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}">{$item.title}</h3>{/if}
        <div class="serendipitySideBarContent">{$item.content}</div>
    </div>
{/if}
{/foreach}
See the IF statement I wrapped around the output? This will prevent showing the nugget with the title "Menu Nugget" in your theme.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Ianardo
Regular
Posts: 114
Joined: Sun Nov 28, 2004 3:02 pm
Location: Hastings, U.K.
Contact:

Post by Ianardo »

Fantastic - i'll try that later :-)

---Later---

Wonderful. Thank you so much.
Post Reply