Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
if_category and clean urls
I use textpattern 4.2.0 with section_id_title url scheme with Lighttpd.
On my frontpage is the following code working for a menu …
<txp:if_section name="artikel">
<txp:if_category name="gesellschaft,meinung,politik,wirtschaft">
<txp:if_category name="gesellschaft">
<li><a href="<txp:site_url />index.php?s=artikel&c=gesellschaft" class="aktiv">Gesellschaft</a> | </li>
<li><a href="<txp:site_url />index.php?s=artikel&c=meinung">Meinung & Analyse</a> | </li>
<li><a href="<txp:site_url />index.php?s=artikel&c=politik">Politik</a> | </li>
<li><a href="<txp:site_url />index.php?s=artikel&c=wirtschaft">Wirtschaft</a></li>
</txp:if_category name="gesellschaft">
<txp:if_category name="meinung">
...
The problem I have is, if I change the messy url scheme in this code to something like that:
<li><a href="<txp:site_url />kategorie/wirtschaft">Wirtschaft</a></li>
then if_category is unable to detect the actual category and the code above isn´t working. That means with categories associated events doesn´t occur.
Is it a bug? Or where can I look for a solution for this issue? Maybe I overlooked something?
Thanks in advance …
Offline
#2 2010-03-27 21:24:23
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_category and clean urls
Doesn’t this code do the same?
<txp:if_section name="artikel">
<txp:category_list categories="gesellschaft,meinung,politik,wirtschaft" break="li">
<txp:category section="artikel" link="1" title="1" active_class="aktiv" /><txp:if_last_category><txp:else /> | </txp:if_last_category>
</txp:category_list>
</txp:if_section>
This way the links will always be correct, also when you change the URL scheme.
Offline
Re: if_category and clean urls
Thanks, your code is working, but the problem still exists. Textpattern doesn´t mark the active category as “activ”. Textpattern does also not recognize, that it is in section “article”. My menu – not so efficient – has different if_section conditions. It is, I think, to long to post it, but anyway here it is:
<ul class="menuliste">
<txp:if_section name="impressum,artikel,archiv,feeds,links,kontakt,mitarbeit,newsletter,service">
<txp:if_section name="artikel">
<li><a href="<txp:site_url />">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/" class="aktiv">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/">Impressum</a></li>
</txp:if_section name="artikel">
<txp:if_section name="service">
<li><a href="<txp:site_url />">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/" class="aktiv">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/">Impressum</a></li>
</txp:if_section name="service">
<txp:if_section name="kontakt">
<li><a href="<txp:site_url />">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/" class="aktiv">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/">Impressum</a></li>
</txp:if_section name="kontakt">
<txp:if_section name="links">
<li><a href="<txp:site_url />">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/" class="aktiv">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/">Impressum</a></li>
</txp:if_section name="links">
<txp:if_section name="archiv">
<li><a href="<txp:site_url />">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/" class="aktiv">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/">Impressum</a></li>
</txp:if_section name="archiv">
<txp:if_section name="feeds">
<li><a href="<txp:site_url />">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/" class="aktiv">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/">Impressum</a></li>
</txp:if_section name="feeds">
<txp:if_section name="impressum">
<li><a href="<txp:site_url />">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/" class="aktiv">Impressum</a></li>
</txp:if_section name="impressum">
<txp:if_section name="mitarbeit">
<li><a href="<txp:site_url />">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/" class="aktiv">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/">Impressum</a></li>
</txp:if_section name="mitarbeit">
<txp:if_section name="newsletter">
<li><a href="<txp:site_url />">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/" class="aktiv">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/">Impressum</a></li>
</txp:if_section name="newsletter">
<txp:else />
<li><a href="<txp:site_url />" class="aktiv">Startseite</a> | </li>
<li><a href="<txp:site_url />artikel/">Rubriken</a> | </li>
<li><a href="<txp:site_url />service/">Nützliches</a> | </li>
<li><a href="<txp:site_url />mitarbeit/">Beteiligung/Mitarbeit</a> | </li>
<li><a href="<txp:site_url />kontakt/">Kontakt</a> | </li>
<li><a href="<txp:site_url />impressum/">Impressum</a></li>
</txp:if_section>
</ul>
<br />
<ul class="menuliste">
<txp:if_section name="artikel,archiv,feeds,links,newsletter,service">
<!--check -->
<txp:if_section name="artikel">
<txp:if_section name="artikel">
<txp:category_list categories="gesellschaft,meinung,politik,wirtschaft,landwirtschaft,personen" break="li">
<txp:category thissection="1" link="1" title="1" active_class="aktiv" /><txp:if_last_category><txp:else /> | </txp:if_last_category>
</txp:category_list>
</txp:if_section>
</txp:if_section name="artikel">
<txp:if_section name="archiv">
<li><a href="<txp:site_url />archiv/" class="aktiv">Archiv</a> | </li>
<li><a href="<txp:site_url />feeds/">Feeds</a> | </li>
<li><a href="<txp:site_url />links/">Links</a> | </li>
<li><a href="<txp:site_url />newsletter/">Newsletter</a> </li>
</txp:if_section name="archiv">
<txp:if_section name="feeds">
<li><a href="<txp:site_url />archiv/">Archiv</a> | </li>
<li><a href="<txp:site_url />feeds/" class="aktiv">Feeds</a> | </li>
<li><a href="<txp:site_url />links/">Links</a> | </li>
<li><a href="<txp:site_url />newsletter/">Newsletter</a> </li>
</txp:if_section name="feeds">
<txp:if_section name="links">
<li><a href="<txp:site_url />archiv/">Archiv</a> | </li>
<li><a href="<txp:site_url />feeds/">Feeds</a> | </li>
<li><a href="<txp:site_url />links/" class="aktiv">Links</a> | </li>
<li><a href="<txp:site_url />newsletter/">Newsletter</a> </li>
</txp:if_section name="links">
<txp:if_section name="newsletter">
<li><a href="<txp:site_url />archiv/">Archiv</a> | </li>
<li><a href="<txp:site_url />feeds/">Feeds</a> | </li>
<li><a href="<txp:site_url />links/">Links</a> | </li>
<li><a href="<txp:site_url />newsletter/" class="aktiv">Newsletter</a> </li>
</txp:if_section name="newsletter">
<txp:if_section name="service">
<li><a href="<txp:site_url />archiv/">Archiv</a> | </li>
<li><a href="<txp:site_url />feeds/">Feeds</a> | </li>
<li><a href="<txp:site_url />links/">Links</a> | </li>
<li><a href="<txp:site_url />newsletter/">Newsletter</a> </li>
</txp:if_section name="service">
<txp:else />
<li> </li>
</txp:if_section>
</ul>
Offline
#4 2010-03-28 15:59:16
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_category and clean urls
whocarez wrote:
Thanks, your code is working, but the problem still exists. Textpattern doesn´t mark the active category as “activ”. Textpattern does also not recognize, that it is in section “article”.
If you’re using my code example, it should. The clean URL variant of /index.php?s=artikel&c=politik is /artikel/?c=politik, not /kategorie/politik. If you use the latter, you are using section default, that’s why Txp doesn’t recognize that it’s in section ‘artikel’; it isn’t.
Edit: the attribute is this_section
, not thissection
.
Last edited by els (2010-03-28 16:00:09)
Offline
Re: if_category and clean urls
Els wrote:
If you’re using my code example, it should. The clean URL variant of /index.php?s=artikel&c=politik is /artikel/?c=politik, not /kategorie/politik. If you use the latter, you are using section default, that’s why Txp doesn’t recognize that it’s in section ‘artikel’; it isn’t.
I manually changed to the “real” clean url variant in my menu-code, because <txp:category_list /
allows “active_class” only in single tags and txp:category
doesn’t have this attribute as textpattern wiki says :-)
Offline
Pages: 1