Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-11-03 18:50:11

Milo Bloom
New Member
Registered: 2005-08-09
Posts: 8

Custom code in list based navigation

I’m putting together my first TXP site and having a great time discovering the possibilities and versatility od the software; it’s exactly the system I wanted :)

I have a small problem that I haven’t been able to find a solution to yet though. I have a navigation menu that is to be based on the section list, presented as an unordered list and formatted using CSS. I have been able to achieve this using

(* denotes line break)
<code>
<div style=“position:absolute; left:0px; top:194px; width:182px; height:286px; z-index:3”> <ul id=“nav”>* <txp:section_list break=“li” />* </ul>*
</div>*
</code>

in my page code, with the relevant code for #nav handling the list CSS.

This works fine, generating the following code in the browser

(* denotes line break)
<code>
<div style=“position:absolute; left:0px; top:194px; width:182px; height:286px; z-index:3”>* <ul id=“nav”>* <li><a href=“url”>Articles</a></li>* <li><a href=“url”>Events</a></li>* <li><a href=“url”>News</a></li>* <li><a href=“url”>Routes</a></li>* <li><a href=“url”>Site-Development</a></li>* </ul>*
</div>
</code>

which works perfectly on a nice, standards compliant browser, but screws up on IE for Windows, which has problems ignoring the line returns between the <li> tags and inserts unwanted gaps. My usual hack round for this on hand cranked sites is to comment out the line returns like this

(* denotes line break)
<code>
<div style=“position:absolute; left:0px; top:194px; width:182px; height:286px; z-index:3”> <ul id=“nav”><!— —><li><a href=“url”>Articles</a></li><!— * —><li><a href=“url”>Events</a></li><!— * —><li><a href=“url”>News</a></li><!— * —><li><a href=“url”>Routes</a></li><!— * —><li><a href=“url”>Site-Development</a></li><!— * —></ul>
</code>

which tricks IE into doing what it should have in the first place. So to my question (and thank you for your patience so far); is there any way I can get my custom code into the page that TXP is generating for me? Or does anyone have any other suggestions to get round the issue. It wouldn’t be the end of the world if I had to insert that menu as a hand coded include, but for the sake of elegance and simplicity, it would be great to keep using the txp:section_list tag to generate the menu.

Offline

Board footer

Powered by FluxBB