Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2020-01-04 11:14:11

etc
Developer
Registered: 2010-11-11
Posts: 5,681
Website GitHub

Re: some ideas needed for txp 4.8 update

colak wrote #320820:

The problem with sub-cats when used on cat1 and cat2, the + sign is used in the url ie /section/cat1+cat2/welcome-to-your-site and totally ignores the hierarchy, even when there is one.

If cat2 is a descendant of cat1, I get /section/cat1/cat2/welcome-to-your-site as expected. Do you mean we should do it by levels, even if cat1 and cat2 are in different branches?

allow duplicate category names when using the /breadcrumb/title/ schema.

This is difficult for bw compatibility reasons, one of the difficulties being ?c=catname URL pattern (whatever scheme) as you note.

Offline

#17 2020-01-04 13:32:43

etc
Developer
Registered: 2010-11-11
Posts: 5,681
Website GitHub

Re: some ideas needed for txp 4.8 update

Okay, unconditional /section/cat1/cat2/title makes sense in section_category mode, changed.

Offline

#18 2020-01-04 18:05:26

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,388
Website GitHub Mastodon Twitter

Re: some ideas needed for txp 4.8 update

etc wrote #320823:

Okay, unconditional /section/cat1/cat2/title makes sense in section_category mode, changed.

Thanks so much Oleg,

I am testing it now!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#19 2020-01-04 18:22:18

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,388
Website GitHub Mastodon Twitter

Re: some ideas needed for txp 4.8 update

etc wrote #320822:

If cat2 is a descendant of cat1, I get /section/cat1/cat2/welcome-to-your-site as expected.

This is indeed true

Do you mean we should do it by levels, even if cat1 and cat2 are in different branches?

I know it is conceptually problematic but that is what I was implying.

This is difficult for bw compatibility reasons, one of the difficulties being ?c=catname URL pattern (whatever scheme) as you note.

I understand. The reason I kicked a fuss is because I think that although branches can give a deeper structure, the limitation of names can eventually lead to semantic issues in the urls

ie. /journal/physics/issues/paper v /journal/quantum-mechanics/issues/paper.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#20 2020-01-04 20:56:39

etc
Developer
Registered: 2010-11-11
Posts: 5,681
Website GitHub

Re: some ideas needed for txp 4.8 update

colak wrote #320828:

The reason I kicked a fuss is because I think that although branches can give a deeper structure, the limitation of names can eventually lead to semantic issues in the urls

You are absolutely right, the new implementation is more flexible, thanks for the fuss and don’t stop :-)

Offline

#21 2020-01-04 22:24:17

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,388
Website GitHub Mastodon Twitter

Re: some ideas needed for txp 4.8 update

Is there a way to evaluate if an article belongs to both cat1 AND cat2? I was thinking along the following lines.

Collect all articles from category 2, but as the category names can be generic I will possibly also get articles which do not have the same category 1

<txp:variable name="cat2">
<txp:article_custom section='<txp:section />' category='<txp:category2 />' limit="999" break=",">
<txp:article_id /></txp:article_custom>
</txp:variable>
<txp:article_custom id='<txp:variable name ="cat2" />' break="li" wraptag="ul">
<txp:if_article_category name='<txp:category1 />'>
<txp:title />
</txp:if_article_category>
</txp:article_custom>

or

<txp:variable name="cat2">
<txp:article_custom section='<txp:section />' category='<txp:category2 />' limit="999" break=",">
<txp:article_id />
</txp:article_custom>
</txp:variable>
<txp:article_custom id='<txp:variable name ="cat2" />' break="li" wraptag="ul">
<txp:evaluate test="category1">
<txp:title />
</txp:evaluate>
</txp:article_custom>

or a clever way of using the related_articles tag in a section/cat1/cat2/ listing page?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#22 2020-01-05 10:10:30

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,656
Website

Re: some ideas needed for txp 4.8 update

etc wrote #320823:

Okay, unconditional /section/cat1/cat2/title makes sense in section_category mode, changed.

Oh, that is real nice. For some reason when I originally tested those new URL patterns I thought this would not possible and then didn’t think more about it. TY both Colak for insisting and Oleg for implementing.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#23 2020-01-05 11:18:59

etc
Developer
Registered: 2010-11-11
Posts: 5,681
Website GitHub

Re: some ideas needed for txp 4.8 update

colak wrote #320838:

Is there a way to evaluate if an article belongs to both cat1 AND cat2?

If you don’t care about pagination, the simplest way seems to be

<txp:variable name="cat1" value='<txp:category1 />' /> <!-- or whatever -->
<txp:variable name="cat2" value='<txp:category2 />' />

<txp:article_custom category='<txp:variable name="cat1" />, <txp:variable name="cat2" />' limit="999" trim>
    <txp:evaluate query='"<txp:category1 />"="<txp:variable name="cat1" />" and "<txp:category2 />"="<txp:variable name="cat2" />"'>
        <txp:title />
    </txp:evaluate>
</txp:article_custom>

If you are sure no cat2 value is used as cat1, you can optimize it:

<txp:article_custom category='<txp:variable name="cat2" />' match="Category2" limit="999" trim>
    <txp:evaluate query='"<txp:category1 />"="<txp:variable name="cat1" />"'>
        <txp:title />
    </txp:evaluate>
</txp:article_custom>

or a clever way of using the related_articles tag in a section/cat1/cat2/ listing page?

Currently related_articles works only in individual article context and uses the same OR logic as article_custom. But we can tweak it for 4.8 release.

phiw13 wrote #320843:

Oh, that is real nice. For some reason when I originally tested those new URL patterns I thought this would not possible and then didn’t think more about it. TY both Colak for insisting and Oleg for implementing.

Please retest whether everything works as expected, thanks.

Offline

#24 2020-01-05 14:50:11

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,388
Website GitHub Mastodon Twitter

Re: some ideas needed for txp 4.8 update

Thanks so much Oleg. I’m testing your suggestions which are not quite working in my pages yet but I know that it is possibly my fault. I’ll keep on trying.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#25 2020-01-06 07:45:01

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,656
Website

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
phiw13 on Codeberg

Offline

#26 2020-01-06 08:57:49

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,388
Website GitHub Mastodon Twitter

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

#27 2020-01-06 12:38:31

etc
Developer
Registered: 2010-11-11
Posts: 5,681
Website GitHub

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

#28 2020-01-06 14:25:35

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,388
Website GitHub Mastodon Twitter

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

#29 2020-01-06 16:02:50

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,388
Website GitHub Mastodon Twitter

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

#30 2020-01-08 09:31:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,388
Website GitHub Mastodon Twitter

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

Board footer

Powered by FluxBB