Page 2 of 2
Re: Different backgrounds for main menu items
Posted: Fri Jan 11, 2008 1:11 pm
by EricG
faglork wrote:
lollipop27 wrote:
Is there a possibility to check if the 4th level node page-alias exists and then insert that one, otherwise check if the third level node page-alias exists, then take this one or if non of this works take a default picture?
Yes. The whole list is in the "classes" array ... just find out the length of the array, and then check for
classes[xx] down to classes[0] ...
You could even skip that array altogether. You could check for the file right there in the while loop which generates the array.
But it is okay with the array ... gives you more possibilities.
hth,
Alex
Is there any chance to show me how to make this work for 2nd and 3rd level node page alias.. i know it works with top level ...
I'm a designer and don't know what to add in these lines... i know it has to check pages with images but don't know how to code it

Re: Different backgrounds for main menu items
Posted: Fri Jan 11, 2008 1:53 pm
by faglork
Hi!
classes[0] --> Top Level
classes[1] --> second Level
classes[2] --> third Level
...
hth,
Alex
Re: Different backgrounds for main menu items
Posted: Sun Jan 13, 2008 1:12 pm
by EricG
Thank you.. I had have changed classes[0] to classes[1] and it went right. Luckily only 2nd level had background images.
But.. and Lollipop did ask the same question earlier in this thread.. what if all level have different background.
I guess let's say there are three levels that first you have to check third level, then second and as last top level if there are graphic files with the same name as there are pages or page aliases...
How do you do that? my knowledge of php is very basic, or better it's almost non existent
faglork wrote:
Hi!
classes[0] --> Top Level
classes[1] --> second Level
classes[2] --> third Level
...
hth,
Alex
Re: Different backgrounds for main menu items
Posted: Sun Jan 13, 2008 1:45 pm
by lollipop27
I did it this way, perhaps it helps you...
Code: Select all
global $gCms;
$classes = array();
$manager =& $gCms->GetHierarchyManager();
$thisPage = $gCms->variables['content_id'];
$currentNode = &$manager->sureGetNodeById($thisPage);
while( isset($currentNode) && $currentNode->getLevel() >= 0 )
{
$currentContent =& $currentNode->getContent();
array_unshift($classes, $currentContent->Alias());
$currentNode =& $currentNode->getParentNode();
}
$picname =$classes[3];
$filename = '/is/htdocs/wp1057983_01UQEWGPWI/com/uploads/images/header/'.$picname.'.jpg';
if (file_exists($filename)) {
echo '/uploads/images/header/'.$picname.'.jpg';
} else {
$picname =$classes[2];
$filename = '/is/htdocs/wp1057983_01UQEWGPWI/com/uploads/images/header/'.$picname.'.jpg';
if (file_exists($filename)) {
echo '/uploads/images/header/'.$picname.'.jpg';
} else {
echo '/uploads/images/header/deutsch.jpg';
}}
you can see that here:
www.360werbung.de
does it help...
Re: Different backgrounds for main menu items
Posted: Sun Jan 13, 2008 2:52 pm
by EricG
lollipop27 wrote:
I did it this way, perhaps it helps you...
Code: Select all
global $gCms;
$classes = array();
$manager =& $gCms->GetHierarchyManager();
$thisPage = $gCms->variables['content_id'];
$currentNode = &$manager->sureGetNodeById($thisPage);
while( isset($currentNode) && $currentNode->getLevel() >= 0 )
{
$currentContent =& $currentNode->getContent();
array_unshift($classes, $currentContent->Alias());
$currentNode =& $currentNode->getParentNode();
}
$picname =$classes[3];
$filename = '/is/htdocs/wp1057983_01UQEWGPWI/com/uploads/images/header/'.$picname.'.jpg';
if (file_exists($filename)) {
echo '/uploads/images/header/'.$picname.'.jpg';
} else {
$picname =$classes[2];
$filename = '/is/htdocs/wp1057983_01UQEWGPWI/com/uploads/images/header/'.$picname.'.jpg';
if (file_exists($filename)) {
echo '/uploads/images/header/'.$picname.'.jpg';
} else {
echo '/uploads/images/header/deutsch.jpg';
}}
you can see that here:
www.360werbung.de
does it help...
Thanks! I will let you know tomorrow
Re: Different backgrounds for main menu items
Posted: Mon Jan 14, 2008 8:50 am
by EricG
Works like a charm. Thank You
lollipop27 wrote:
I did it this way, perhaps it helps you...
you can see that here:
www.360werbung.de
does it help...
Re: Different backgrounds for main menu items
Posted: Mon Jan 14, 2008 11:29 pm
by faglork
Working with CMSMS is pure fun ...
Sometimes you just can't believe how simple it is.
Cheers,
Alex
Re: Different backgrounds for main menu items
Posted: Wed Jan 16, 2008 12:54 am
by Dr.CSS
Re: Different backgrounds for main menu items
Posted: Thu Jan 17, 2008 8:15 am
by Dr.CSS
You can use some $node-> calls to point out certain parts of the page, title, alias, id #...
$node->alias, can be used alias}" and alias}"...
More can be found in the Menu Manager Help read bolded words \/ below...