Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2020-01-15 08:09:33

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,289
Website

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.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#32 2020-01-15 10:14:18

etc
Developer
Registered: 2010-11-11
Posts: 3,940
Website

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

#33 2020-01-15 10:44:02

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,939
Website

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

#34 2020-01-15 11:46:02

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,289
Website

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.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#35 2020-01-15 12:21:16

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,289
Website

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.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#36 2020-01-21 06:49:48

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,289
Website

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.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#37 2020-01-21 08:18:38

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,289
Website

Re: some ideas needed for txp 4.8 update

By updating all files to the latest txp dev version all is working OK again!

Note to self. Follow the advice and always keep up with the latest dev versions.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB