Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2006-12-11 22:25:06

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: the latest : liberti.org

jstubbs,
Both of those will work fine.
There are multiple good ways to do this, some that minimize the html, and have better semantics than others… always more to learn there.


Offline

#32 2006-12-12 02:50:21

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: the latest : liberti.org

Thanks Daniel and Mathew – I missed the if_section tag. I will check out the options tomorrow and see what happens ;-)

Offline

#33 2006-12-15 15:43:55

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: the latest : liberti.org

Hi again, have the following code now, which mainly works fine, with the exception that the drop down menu ONLY displays within the given section, not when the user is in ANY section.

What should happen is a regular drop down menu which is viewable anywhere on the site. The “if_section” tags are to check where the user is, and then style the current link. It appears though that the if_section is stopping the drop down from displaying unless the user is in that particular section.

cbs_category_list is used to check if categories exist, and if they have articles assigned, then display the drop down. There are no problems with this.

Code:

<ul id=“nav”>
<li><a <txp:if_section name=”“>class=“active”</txp:if_section>href=”<txp:site_url />”>Forside</a></li>
<li><a <txp:if_section name=“nyheter”>class=“active”</txp:if_section>href=”<txp:site_url />nyheter/”>Nyheter</a></li>
<li><a <txp:if_section name=“tsmg”>class=“active”</txp:if_section>href=”<txp:site_url />tsmg/”>TSMG</a>
<txp:cbs_category_list parent=“TSMG” wraptag=“ul” break=“li” class=”“ /></li>
<li><a <txp:if_section name=“spesialistklinikken”>class=“active”</txp:if_section>href=”<txp:site_url />spesialistklinikken/”>Spesialistklinikken</a>
<txp:cbs_category_list parent=“spesialistklinikken” wraptag=“ul” break=“li” class=”“ /></li>
<li><a <txp:if_section name=“akademiet”>class=“active”</txp:if_section>href=”<txp:site_url />akademiet/”>Akademiet</a>
<txp:cbs_category_list parent=“akademiet” wraptag=“ul” break=“li” class=”“ /></li>
<li><a <txp:if_section name=“behandling”>class=“active”</txp:if_section>href=”<txp:site_url />behandling/”>Behandling</a>
<txp:cbs_category_list parent=“behandling” wraptag=“ul” break=“li” class=”“ /></li>
<li><a <txp:if_section name=“tannhelsepersonell”>class=“active”</txp:if_section>href=”<txp:site_url />tannhelsepersonell/”>Tannhelsepersonell</a>
<txp:cbs_category_list parent=“tannhelsepersonell” wraptag=“ul” break=“li” class=”“ /></li>
<li><a <txp:if_section name=“kontakt-oss”>class=“active”</txp:if_section>href=”<txp:site_url />kontakt-oss/”>Kontakt Oss</a></li>
</ul>

Produces the following when in the “Behandling” section:

<li><a class=“active“href=“http://tsmg.no/behandling/”>Behandling</a>
<ul> <li><a href=“http://tsmg.no/behandling/?c=bleking”>bleking</a></li>
</ul></li>

But when in another section:

<li><a href=“http://tsmg.no/behandling/”>Behandling</a>
</li>

Am out of ideas. Hope someone can help ;-)

Offline

#34 2006-12-16 05:14:43

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: the latest : liberti.org

Been trying to fix my problem without success. The Javascript is loaded in every page so that should not be an issue. Code:

<script type=“text/javascript”><!—//—><![CDATA[//><!—

sfHover = function() { var sfEls = document.getElementById(“nav”).getElementsByTagName(“LI”); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=” sfhover”; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(” sfhover\\b”), “”); } }
}
if (window.attachEvent) window.attachEvent(“onload”, sfHover);

//—><!]]></script>

Edit: I found the problem – it is cbs_category_list that is the issue, as it only outputs the categories when one is within the section, as it is section-sensitive.

category_list tag is also possible, and works fine, but outputs all categories regardless of whether or not articles exist within the category. That’s why cbs_category_list is better, because it does not output the category if articles do not exist.

Any possible solution to this??

Last edited by jstubbs (2006-12-16 05:31:57)

Offline

Board footer

Powered by FluxBB