Plugins for Homepage Only, Pt. 2
Plugins for Homepage Only, Pt. 2
I am trying without success to add code for a plugin (with a "html nugget") that will allow that plugin to appear ONLY on the "home," or "index," page.
I don't want the plugin to appear on any of the "category" pages, nor on any of the "archives" pages, just ONE page.
So far, I have been able (through your gracious help!) to have the plugin NOT appear on any of the "category" pages with a "sidebar hider" plugin. But I have not been able to do this same for "archives" pages.
I'm sure there is a way to do this, but I am not adept enough to figure it out!
Does anyone have any suggestions?
Any help would be appreciated!!!
I don't want the plugin to appear on any of the "category" pages, nor on any of the "archives" pages, just ONE page.
So far, I have been able (through your gracious help!) to have the plugin NOT appear on any of the "category" pages with a "sidebar hider" plugin. But I have not been able to do this same for "archives" pages.
I'm sure there is a way to do this, but I am not adept enough to figure it out!
Does anyone have any suggestions?
Any help would be appreciated!!!
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Plugins for Homepage Only, Pt. 2
Hi!
I suppose the easiest way is to edit your template's sidebar.tpl template file. Inside the loop where each plugin is emitted you could add a siwtch like:
HTH,
Garvin
I suppose the easiest way is to edit your template's sidebar.tpl template file. Inside the loop where each plugin is emitted you could add a siwtch like:
Code: Select all
{foreach from=$plugindata item=item}
{if $item.class == 'serendipity_plugin_myplugin' AND $view == 'archives'}
<!-- plugin hidden! -->
{else}
<div class="serendipitySideBarItem container_{$item.class}">
{if $item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}"
<div class="serendipitySideBarContent">{$item.content}</div>
</div>
{/if}
{/foreach}
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/
# 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/
Re: Plugins for Homepage Only, Pt. 2
This code doesn't work for me. I added it to the sidebar plugin and get an error.garvinhicking wrote:Hi!
I suppose the easiest way is to edit your template's sidebar.tpl template file. Inside the loop where each plugin is emitted you could add a siwtch like:
HTH,Code: Select all
{foreach from=$plugindata item=item} {if $item.class == 'serendipity_plugin_myplugin' AND $view == 'archives'} <!-- plugin hidden! --> {else} <div class="serendipitySideBarItem container_{$item.class}"> {if $item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}" <div class="serendipitySideBarContent">{$item.content}</div> </div> {/if} {/foreach}
Garvin
Code: Select all
Fatal error: Smarty error: [in file:/www.domain.com/blog/templates/default/sidebar.tpl line 11]: syntax error: mismatched tag {/foreach}. expected {/if} (opened line 5). (Smarty_Compiler.class.php, line 2338) in /www.domain.com/blog/bundled-libs/Smarty/libs/Smarty.class.php on line 1093
I just want to disable the serendipity_plugin_externalphp for all pages apart from the index page.
What am I doing wrong? Thanks for any help
Check out this blog today!
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Plugins for Homepage Only, Pt. 2
Hi!
My code wasn't properly meant to be copy and pasted; I was missing some characters in this line:
you would need to edit your original sidebar.tpl, and insert only the first {if} and {else} part of the pasted code, which is the relevant. Or append the line above with the true contents of your sidebar.tpl...
HTH,
Garvin
My code wasn't properly meant to be copy and pasted; I was missing some characters in this line:
Code: Select all
{if $item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}"
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/
# 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/
Re: Plugins for Homepage Only, Pt. 2
Sorry Gavin I'm completely useless at this! So I edited the sidebar.tpl with this and all the sidebar plugins disappeared. How do I tweak it to just show the externalphp plugin on just the home page?
Code: Select all
{foreach from=$plugindata item=item}
{if $item.class == 'serendipity_plugin_externalphp' AND $view == 'archives'}
<!-- plugin hidden! -->
<div class="serendipitySideBarItem container_{$item.class}">
{$item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}"
<div class="serendipitySideBarContent">{$item.content}</div>
</div>
{/if}
{/foreach}
Check out this blog today!
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Plugins for Homepage Only, Pt. 2
Hi!
Try this:
Only this "else" was missing!
HTH,
Garvin
Try this:
Code: Select all
{foreach from=$plugindata item=item}
{if $item.class == 'serendipity_plugin_externalphp' AND $view == 'archives'}
<!-- plugin hidden! -->
{else}
<div class="serendipitySideBarItem container_{$item.class}">
{$item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}"
<div class="serendipitySideBarContent">{$item.content}</div>
</div>
{/if}
{/foreach}
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/
# 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/
Re: Plugins for Homepage Only, Pt. 2
That doesn't work for me either, the sidebar now looks all funny and the externalphp plugin still shows on all pages, see here: http://www.jamesmcara.com/blog/
This is the exact code in my sidebar.tpl :
This is the exact code in my sidebar.tpl :
Code: Select all
{if $is_raw_mode}
<div id="serendipity{$pluginside}SideBar">
{/if}
{foreach from=$plugindata item=item}
{if $item.class == 'serendipity_plugin_externalphp' AND $view == 'archives'}
<!-- plugin hidden! -->
{else}
<div class="serendipitySideBarItem container_{$item.class}">
{$item.title != ""}<h3 class="serendipitySideBarTitle {$item.class}"
<div class="serendipitySideBarContent">{$item.content}</div>
</div>
{/if}
{/foreach}
{if $is_raw_mode}
</div>
{/if}
Check out this blog today!
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Plugins for Homepage Only, Pt. 2
Hi!
I'm sorry. I didn't notice the code you pasted still had the invalid code of my original template. I thought you looked it up in your template.
Now I did that work.
Try to understand that and look up the original contents of your template to see what this actually does.
Regards,
Garvin
I'm sorry. I didn't notice the code you pasted still had the invalid code of my original template. I thought you looked it up in your template.
Now I did that work.
Code: Select all
{if $is_raw_mode}
<div id="serendipity{$pluginside}SideBar">
{/if}
{foreach from=$plugindata item=item}
{if $item.class == 'serendipity_plugin_externalphp' AND $view == 'archives'}
<!-- plugin hidden! -->
{else}
<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}
{if $is_raw_mode}
</div>
{/if}
Regards,
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/
# 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/
Re: Plugins for Homepage Only, Pt. 2
Thanks Gavin, it seems to work now. The externalphp plugin now only shows on the index page. I added some extra parameters for the different views.
Was this the best way to do it? Have I missed anything out?
Was this the best way to do it? Have I missed anything out?
Code: Select all
{foreach from=$plugindata item=item}
{if $item.class == 'serendipity_plugin_externalphp' AND $view == 'archives'}
{elseif $item.class == 'serendipity_plugin_externalphp' AND $view == 'archive'}
{elseif $item.class == 'serendipity_plugin_externalphp' AND $view == 'entry'}
{elseif $item.class == 'serendipity_plugin_externalphp' AND $view == 'categories'}
{elseif $item.class == 'serendipity_plugin_externalphp' AND $view == 'staticpage'}
<!-- plugin hidden! -->
{else}
<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}
Check out this blog today!
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Plugins for Homepage Only, Pt. 2
Hi!
That looks okay - I wouldn't immediately know of anything missing...
Regards,
Garvin
That looks okay - I wouldn't immediately know of anything missing...
Regards,
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/
# 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/
Re: Plugins for Homepage Only, Pt. 2
Wouldn't this be a better use of the code using IF $view DOES NOT EQUAL ‘index’?
What is the view parameter for the index page?
What is the view parameter for the index page?
Code: Select all
{foreach from=$plugindata item=item}
{if $item.class == 'serendipity_plugin_externalphp' AND $view != 'index'}
<!-- plugin hidden! -->
{else}
<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}
Check out this blog today!
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
Re: Plugins for Homepage Only, Pt. 2
Ok I have nailed it this time! I was looking for 'start'
Can you just confirm there won't be any problems using that code Gavin?
Can you just confirm there won't be any problems using that code Gavin?
Code: Select all
{foreach from=$plugindata item=item}
{if $item.class == 'serendipity_plugin_externalphp' AND $view != 'start'}
<!-- plugin hidden! -->
{else}
<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}
Check out this blog today!
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Plugins for Homepage Only, Pt. 2
Hi!
Sure, that would also work just fine - I think the result is the same
Regards,
Garvin
Sure, that would also work just fine - I think the result is the same
Regards,
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/
# 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/
Re: Plugins for Homepage Only, Pt. 2
Yes but this coding seems like a more eloquent solution
Check out this blog today!
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.
Buy Eye Secrets strips.
Best devices reviewed at http://www.penisstretchers.org/.
Order Capsiplex slimming pills today.
Buy Meratol diet pills online.