Thursday 12 May 2005 4:58:04 pm
Hi there, I have searched the forums pretty extensively for the past 2 days looking for an answer to my problem (the first of many I imagine) but with no success, though maybe if I was a little more familiar with the EZsyntax I may have seen the answer in my travels. Quite simply I need to be able to dynamically pull the body id from the current page URI, the reason for this is my menu is constructed with some very complex CSS to achieve the look I need. So far I have found that I am able to pull the node name into the id="" but the problem with this is that some of my pages have more than one word in the name; for example the output would look like this-
<body id="about us">
<div id="navigation">
....
contents
....
</div>
</body>
This is not much good to me for the obvious reason that CSS selectors are useless with a space in them. So I noticed EzP inserts a "_" into the spaces when cleaning up the URI therefore the page URI is the ideal element for an ID.
<body id="about_us">
<div id="navigation">
....
contents
....
</div>
</body>
I have tried many different variations of the following code but to no avail, the best I have managed is something like "products/mens_wear", and extracting a portion of the name is no good because my top level navigation is so varied for example- Products | About Us | Members Login etc...
{section loop=$node.path_array offset=2}
{let page_name=fetch( content, node, hash( node_id, $item ) )}
{run-once}
<body id="{$page_name.name}">
{/run-once}
{/let}
{/section}
The main problem I am having is that the offset dose not seem to be relative to the actual node I am viewing if that makes any sense, so if I was to navigate to "Products/mens_wear" the node name would still be "products" not "mens_wear". I hope I have made this clear if not please let me know and I will try to be more descriptive. Any help is very much appreciated thankyou for your time.
Pardon me while I burst into flames...
|