Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: contextual navigation
I just uploaded the particular page I am working on as well as the related forms on github. Note that for the listform above, I only uploaded the partially working version which lists the correct articles when the article only belongs to one category, and when it has no categories at all.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: contextual navigation
I’ve just committed a tweak to enable finer filtering:
<!-- no categories -->
<txp:article_custom exclude="category" />
<!-- Category1 without Category2 -->
<txp:article_custom category='<txp:category1 />' match="Category1" exclude="Category2" />
<!-- matching both categories from URL -->
<txp:article_custom match="Category1=2, Category2=3" />
Something like this should work on individual pages in section/category scheme, please test:
<txp:if_article_category number="1">
<txp:if_article_category number="2">
<txp:article_custom section match="Category1=2, Category2=3" form="article_listing" />
<txp:else />
<txp:article_custom section match="Category1=2" exclude="Category2" form="article_listing" />
</txp:if_article_category>
<txp:else />
<txp:article_custom section exclude="category" form="article_listing" />
</txp:if_article_category>
Offline
Re: contextual navigation
Niiice! That’s super slick. I presume this’ll make the custom-fields branch merge, umm, interesting though, hehe. I daren’t try it :)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Online
Re: contextual navigation
Thanks so much Oleg. Your tweaks and suggestion work just fine with a minor issue when viewing Cat1-only articles. I overcame this easily by using the traditional syntax. I could have used a related_articles tag there but I think that keeping an unlinked title helps with the positioning of the article during surfing. Here is what it absolutely appears to be the working code including some niche parameters I have introduced.
<txp:if_article_category number="1">
<txp:if_article_category number="2">
<txp:article_custom section match="Category1=2, Category2=3" form="" listform="" c10="y" wraptag="ul" break="li" label='Other <txp:category1 /> <txp:section />' labeltag="h4" class="submenu" limit="999">
<txp:if_article_id>
<span><txp:title /></span>
<txp:else />
<a href="<txp:permlink />" rel="bookmark"><txp:title /></a>
</txp:if_article_id>
</txp:article_custom>
<txp:else />
<txp:article_custom label='Other <txp:category1 /> <txp:section />' labeltag="h4" section='<txp:section />' category='<txp:category1 />' form="" listform="" limit="100" wraptag="ul" break="li" class="submenu">
<txp:if_article_id>
<span><txp:title /></span>
<txp:else />
<a href="<txp:permlink />" rel="bookmark"><txp:title /></a>
</txp:if_article_id>
</txp:article_custom>
</txp:if_article_category>
<txp:else />
<txp:article_custom status section form="" listform="" label='Other <txp:section />' labeltag="h4" limit="999" wraptag="ul" break="li" c10="x" class="submenu">
<txp:if_article_category>
<txp:if_custom_field name="status" value="5">
<a href="/<txp:section />/<txp:category1 />/" rel="follow"><txp:title /></a>
</txp:if_custom_field>
<txp:else />
<txp:if_article_id>
<span><txp:title /></span>
<txp:else />
<a href="<txp:permlink />" rel="bookmark"><txp:title /></a>
</txp:if_article_id>
</txp:if_article_category>
</txp:article_custom>
</txp:if_article_category>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: contextual navigation
Bloke wrote #321069:
Niiice! That’s super slick. I presume this’ll make the custom-fields branch merge, umm, interesting though, hehe. I daren’t try it :)
Just saw your post:) It is a beauty. I found that I needed the CFs as I created some faux landing pages in order to parse some info from the articles’ CFs but also to place those links on the correct spot of the timeline.
This update requires a learning curve for me but I enjoy witnessing the flexibility of txp surpassing another level.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: contextual navigation
etc wrote #321068:
I’ve just committed a tweak to enable finer filtering…
Bloke wrote #321069:
Niiice! That’s super slick.
Agree! Ever more flexibility. And what a tweak: just three characters changed around. Wow!
TXP Builders – finely-crafted code, design and txp
Offline