Topic: Display components in specific page only.
Hello,
How could I make some components display in only some pages instead of all?
Thanks.
You are not logged in. Please login or register.
We had problems with our forum being hacked. From what we can tell, all data is safe, but it forced us to upgrade our PunBB installation. Announcement
GetSimple Support Forum → General Questions → Display components in specific page only.
Hello,
How could I make some components display in only some pages instead of all?
Thanks.
You can insert in your template something like:
<?php if (return_page_slug()=='thatpage') get_component('thatcomponent'); ?>(replace thatpage by your page identifier (slug) and thatcomponent by your component id.)
...Or you could use the DynPages plugin.
Thank you but I want the components to be on the sidebar, plus I have a lot of pages in my website.
If you give every component the same id as their corresponding page slugs, you can insert this in the sidebar:
<?php get_component(return_page_slug()); ?>That is, a page with slug my-page would display component with name my-page (if that component exists).
I want to have one conponent for like twenty pages.
Do those pages have something in common? (same parent page, or some string in the page slug, ...)
If not, something like
<?php
if (in_array(return_page_slug(),array(
'slug1'
,'slug2'
,'slug3'
// ...
,'slug20'
))) get_component('componentname');
?>might work (not tested).
Thank you.
Same parent actually.
Then it's easier:
<?php if (get_parent(0)=='parentpage') get_component('componentname'); ?>Great, thanks. I figured it out and worked perfectly!!
my question to this topic is that how would i have a topic header in the sidebar identified as per page then the content that i want in that sidebar ?
my question to this topic is that how would i have a topic header in the sidebar identified as per page then the content that i want in that sidebar ?
If I understood what you're asking, get the Exec-PHP plugin and put this in the sidebar component.
<?php get_page_title(); ?>GetSimple Support Forum → General Questions → Display components in specific page only.
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 4 official extensions. Copyright © 2003–2009 PunBB.