Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: some ideas needed for txp 4.8 update
etc wrote #320844:
Please retest whether everything works as expected, thanks.
So far, everything still works in a not-exhaustive testing on my favourite playground. I think Colak already flagged an issue with breadcrumbs elsewhere, though. I’ve never used those, I can’t say.
[must get back up-to-speed after the traditional 5 day New Years festivities – the year of the rat!]
Last edited by phiw13 (2020-01-06 07:46:39)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: some ideas needed for txp 4.8 update
etc wrote #320844:
If you don’t care about pagination, the simplest way seems to be
<txp:variable name="cat1" value='<txp:category1 />' /> <!-- or whatever -->...
This is what I have now (simplified hear for readability) cat1 listings are working as expected when there is no cat2. When there is a cat2 article listings are not correct on either /section/cat1/
or /section/cat1/cat2/
where the same articles are listed:(
Also, I seem to have hit a limitation of the zem_redirect plugin which redirects /section/cat1/cat2/
to /section/cat2/
. Disabling it, the page loads but shows the same content as on /section/cat1/
The method I am experimenting with is by using a custom field, c10
, and its values
<txp:variable name="cat1" value='<txp:category1 />' />
<txp:variable name="cat2" value='<txp:category2 />' />
<txp:hide>-category 1-</txp:hide>
<txp:if_category number="1">
<txp:if_variable name="cat2" value="">
<txp:article limit="30" c10="" listform="list_cat_projects" form="" />
<txp:else />
<txp:hide>-Category 2-</txp:hide>
<txp:evaluate query='"<txp:category1 />"="<txp:variable name="cat1" />" and "<txp:category2 />"="<txp:variable name="cat2" />"'>
<txp:article_custom category='<txp:variable name="cat1" />, <txp:variable name="cat2" />' limit="999" listform="list_cat_projects" c10="y" trim />
</txp:evaluate>
</txp:if_variable>
</txp:if_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: some ideas needed for txp 4.8 update
Sorry, I don’t understand the logic now that you have inverted article_custom
and evaluate
tags nesting.
Offline
Re: some ideas needed for txp 4.8 update
Maybe I am understanding it wrongly but here’s the logic
1. When on category page of a section, check if there is no category 2
and return a list of articles which only have category 1
using the list_cat_projects
listform and with a conditional that the c10 custom field is empty.
else /
2. For articles belonging to both category 1
and category 2
, evaluate if the cat1 and cat2 variables are identical for each article but also only list articles that the c10 field has the value of y
.
In real life, for the second case, all urls of articles contain, /projects/respublika/exhibitions/
and the article title. There will be another cat2 for seminars, etc, once a generic solution if found for this one.
The projects
section of the new site design will the the most complex one and it will replace what we have now as events
and participations
and it will be the only section which will need this url depth.
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: some ideas needed for txp 4.8 update
Just to say that I also tried
<txp:if_section name='<txp:section />'>
<txp:if_search>
<txp:article pgonly="1" searchall="1" searchsticky="0" />
<txp:if_search_results>
You searched for <strong><txp:page_url type="q" /></strong>. <txp:search_result_count />
<txp:else />
no results
</txp:if_search_results>
<txp:article limit="999" searchall="1" />
<txp:hide>============-Category 1-============</txp:hide>
<txp:if_category number="1">
<txp:if_variable name="cat2" value="">
<txp:article limit="30" c10="" listform="list_cat_projects" form="" />
<txp:else />
<txp:hide>============-Category 2-============</txp:hide>
<txp:if_category number="2">
<txp:variable name="cat1" value='<txp:category1 />' />
<txp:variable name="cat2" value='<txp:category2 />' />
<txp:article_custom category='<txp:variable name="cat1" />, <txp:variable name="cat2" />' limit="999" c10="y" trim>
<txp:evaluate query='"<txp:category1 />"="<txp:variable name="cat1" />" and "<txp:category2 />"="<txp:variable name="cat2" />"'>
<txp:output_form form="list_cat_projects" />
</txp:evaluate>
</txp:article_custom>
<txp:else />
<txp:hide>=============-Section's home page-==============</txp:hide>
<txp:article_custom status section='<txp:section />' c10="x" listform="my_form" limit="999" />
</txp:if_category>
</txp:if_category>
</txp:if_search>
</txp:if_section>
> Edited to add that these pages will have very little content. The section’s landing page currently has under 50 links (although this is expected to grow), but as we go deeper, the max links expected for any /section/cat1/ or /section/cat1/cat2/ page is less than 30.
For the foreseeable future, we do not expect to have any pagination to any of these pages in the particular section.
Last edited by colak (2020-01-06 16:17:01)
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: some ideas needed for txp 4.8 update
Although I do not understand it conceptually, this solves the issue here!!!
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: some ideas needed for txp 4.8 update
Firstly I’ll start with an apology for all the questions.
Although my last post in this thread had the article_lists sorted,since I implemented the latest tweak, articles are not listed properly in article lists, under the /section/cat1/cat2/
urls. The code I am using can be found on github
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: some ideas needed for txp 4.8 update
colak wrote #321102:
Although my last post in this thread had the article_lists sorted,since I implemented the latest tweak, articles are not listed properly in article lists, under the
/section/cat1/cat2/
urls. The code I am using can be found on github
Sorry Yiannis, the code is quite long and unindented, hard to analyse. You might want to reduce it to a bare minimum for tests and extend once working.
Offline
Re: some ideas needed for txp 4.8 update
etc wrote #321104:
Sorry Yiannis, the code is quite long and unindented, hard to analyse. You might want to reduce it to a bare minimum for tests and extend once working.
I agree. Up to now I’ve copied your code out into Atom, set it to HTML and run the Beautifier plugin over it to auto-indent it (not perfect but better). My own page templates also have a tendency to get increasingly complex as I add more, but I try to go back and modularise it so that the page templates do the logic and output_forms do the content chunks. That may help you with the contextual menu in individual_article and article_list contexts which you have completely separated in your page template at the moment, but the contextual menu will probably duplicate much of the code.
TXP Builders – finely-crafted code, design and txp
Offline
Re: some ideas needed for txp 4.8 update
You are absolutely right: here is the simplyfied code
<txp:if_article_list>
<txp:hide>==================-section article lists-======================</txp:hide>
<txp:if_section section>
<txp:hide>==================-search-======================</txp:hide>
<txp:if_search>
<txp:article pgonly="1" searchall="1" searchsticky="0" />
<txp:if_search_results>
<h3>You searched for <strong><txp:page_url type="q" /></strong>. <txp:search_result_count />.</h3>
<txp:else />
no results
</txp:if_search_results>
<txp:article limit="999" searchall="1" />
<txp:else />
<txp:variable name="cat1" value='txp:page_url type="2" />' />
<txp:variable name="cat2" value='<txp:page_url type="3" />' />
<txp:hide>==================-category 1-======================</txp:hide>
<txp:if_category number="1">
<txp:if_variable name="cat2" value="">
<txp:article status limit="30" listform="list_cat2_projects" form="" c10="" />
<txp:else />
<txp:hide>==================-Category 2-======================</txp:hide>
<txp:article limit="999" match="Category1=2, Category2=3" form="list_cat_projects" c10="y" />
</txp:if_variable>
<txp:else />
<txp:hide>==================-section landing page-======================</txp:hide>
<txp:article_custom status section c10="x" form="" limit="999">
<txp:if_article_category>
<a rel="follow" href="/<txp:section />/<txp:category1 />/"><txp:title /></a>
<txp:else />
<a href="<txp:permlink />" rel="bookmark"><txp:title /></a>
</txp:if_article_category>
</txp:article_custom>
</txp:if_category>
</txp:if_search>
</txp:if_section>
</txp:if_article_list>
Cat2 is the only part that does not produce the expected results.
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: some ideas needed for txp 4.8 update
[SOLVED]: That was the zem_redirect screwing things up. I thought I disabled it but obviously I was wrong! The caveats of working on multiple tabs.
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: some ideas needed for txp 4.8 update
OK, the article listings for match="Category1=2, Category2=3"
suddenly stopped working again and I cannot spot where the code is misfiring. (zem_redirect is deleted)
<txp:if_article_list>
<txp:variable name="cat1" value='<txp:page_url type="2" />' />
<txp:variable name="cat2" value='<txp:page_url type="3" />' />
<txp:if_category number="1">
<txp:if_variable name="cat2" value="">
<txp:article status limit="30" listform="list_cat2_projects" form="" c10="" />
<!-- works -->
<txp:else />
<txp:article limit="999" listform="list_cat_projects" match="Category1=2, Category2=3" form="" c10="y" />
<!-- returns articles from section and cat1 but without matching cat2. ie. it returns the same articles when visiting /section/cat1-title/cat2-title1/ and /section/cat1-title/cat2-title2/ -->
</txp:if_variable>
<txp:else />
<p>Section's landing page.</p>
<!-- works -->
</txp:if_category>
</txp:if_article_list>
I use the number
attribute in the if_category
part which appears to be an undocumented attribute. Does it only exist on if_article_category
? Deleting the attribute does not make any difference.
I also tried replacing txp:if_category number="1"
with if_variable name="cat1"
which did not work.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline