Page 1 of 1
different bg image image for any section
Posted: Mon Dec 26, 2005 5:44 pm
by akronim
hi i need a little help
i want to have a different image for avery section of the site ( i.e. for any first level in the hierarchy)
i'm using ellnav+L menu
i've defined a tag i called
bgpage that i use to change the background stile in the ellnav template
$p=$_GET['page'];
switch ($p) {
case La_compagnia:
echo "style=" background: #fff url(banner/08.jpg) no-repeat 200px 80px; " ";
break;
default :
echo "style=" background: #fff url(banner/02.jpg) no-repeat 200px 80px; " ";
}
but this dont fits well to my needs, cause avery page have a different name (?alias?).
i need to know and to use the variable that the
breadcrumbs tag uses to get and generate the first level of the adress
any help??
Re: different bg image image for any section
Posted: Tue Mar 21, 2006 6:25 pm
by Dan
I placed the below code into a user defined tag, and then referenced it in my template {the_name_of_my_userdefinedtag}. what it does is take the "name" of a page and determines what HTML gets writen in order to control images, nav on states, etc. once you have the name of the page, the if, elseif and else statement can control enything in the template. it saved me from having 10 versions of the nav (I needed an on state when the user was on a particular page, and to insert some javascript on the homepage only). Being able to do this saved me a ton of time.
-----------------------------------------------------------
global $gCms;
$thispage = '';
$thispage = $gCms->variables['page_name'];
if ($thispage == the_name_of_one_of_your_pages) echo "something_you'd_like_written_to_this_page";
elseif ($thispage == the_name_of_another_one_of_your_pages) echo "something_else_you'd_like_written_to_this_page";
else echo "something_you'd_like_written_as_your_default";
Re: different bg image image for any section
Posted: Tue Mar 21, 2006 8:13 pm
by jelle
hey, this is the third spot you placed this post... are there any more. Pimping your code a bit is ok, but wouldn't this be more efficient with a link?
Re: different bg image image for any section
Posted: Tue Mar 21, 2006 10:33 pm
by Dan
jelle wrote:
hey, this is the third spot you placed this post... are there any more. Pimping your code a bit is ok, but wouldn't this be more efficient with a link?
Sorry if you see it as pimping--I won't post anything helpful here going forward. I had been looking for an example like this in the forum for a little while. Once I figured it out, I thought it might help some other people (i.e. I couldn't have been the only person looking for an example like this). Again, my apologies.
Re: different bg image image for any section
Posted: Tue Mar 21, 2006 10:39 pm
by calguy1000
Jette may have been a bit forward, your code is a great example of how to do things, just pleaase don't copy and paste it in lots of places. Post it once, and if required link to it in other places.
we need all of the contributions we can get, please don't stop.
Re: different bg image image for any section
Posted: Wed Mar 22, 2006 9:34 am
by jelle
@Calguy1000: are you a bit upset I omitted the '1000' in your name?

Re: different bg image image for any section
Posted: Wed Mar 22, 2006 3:20 pm
by calguy1000
no, not at all
