advanced Newsbox function

Third Party Plugins to CMSimple - how to install, use and create plugins

Moderator: Tata

Post Reply
kweku
Posts: 90
Joined: Sun Jan 18, 2009 3:37 pm

advanced Newsbox function

Post by kweku » Tue May 12, 2009 10:30 am

hi,
i have a test site at http://www.insight-design-group.com/imc ... x.php?Poll - each parent menu item has a unique banner image which is done using the newsbox technique youll find here http://www.cmsimplewiki.com/doku.php/ti ... ific_pages

so far so good, the problem is that when i click on any sub-menu item the banner changes to the generic banner - this was fine at first but what i would like to happen is for the unique image banner to remain throughout the sub-menu and sub-sub-menu items.

currently i can only achieve this by manually going into each sub-page and adding the cmsimple newsbox script - you can imagine the mess if i tried to get a client or novice to login and manage their content like that!

is there someone clever enough out there to know how to automatically get the unique banner images to remain constant for each menu item?

if you look at the 'services' menu item - http://www.insight-design-group.com/imc ... p?Services - you'll notice the first two sub-pages retain the unique banner image ( this is using #CMSimple $news = 'alt2';# in the content area , whereas....

the sub-pages for this parent item only show the generic image - http://www.insight-design-group.com/imc ... x.php?Poll - check the sub-pages
my template uses something similar to this <?php if ($news==""){echo newsbox("mainImage");} else {echo newsbox($news);} ?> - like the wiki example.

look forward to your replies... ;)

Till
Posts: 337
Joined: Tue May 20, 2008 7:20 am
Location: Germany: Bremen
Contact:

Re: advanced Newsbox function

Post by Till » Wed May 13, 2009 6:03 pm

In the moment, that's not so easy. There may be a plugin soon which could help. However, just right now there is a manual way to solve this issue.
So, you could add to your template at that position where you want to change the Newsbox:

Code: Select all

if (strtok($su,':') == "Services") {echo newsbox("NBox1");} 
elseif (strtok($su,':') == "Poll") {echo newsbox("NBox2");} 
else {echo newsbox("NBox3");}
This should do the job. However, you cannot change headings anymore.

Or you generate an external php file and include it here.

Code: Select all

<?php
switch(strtok($su,':')) 
{
case "Services": echo newsbox("NBox1"); break;
case "Poll": echo newsbox("NBox2"); break;
case "Faqs": echo newsbox("NBox3"); break;
case "Media": echo newsbox("NBox4"); break;
.
.
.
default: echo newsbox("defaultbox"); break;
}
?>
Till

kweku
Posts: 90
Joined: Sun Jan 18, 2009 3:37 pm

Re: advanced Newsbox function

Post by kweku » Wed May 13, 2009 11:10 pm

thanks a lot Till,

i will give this a try :)

kweku
Posts: 90
Joined: Sun Jan 18, 2009 3:37 pm

Re: advanced Newsbox function

Post by kweku » Thu May 14, 2009 12:47 am

Till,
you are the man! :D

works perfectly - i love cmsimple

Post Reply