Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2021-01-20 10:15:36

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,218
Website GitHub

Re: if individual article, if category, if section...

etc wrote #328238:

Just for fun, you could (try to) rewrite

<txp:if_first_image><txp:image /><txp:else /><txp:thumbnail /></txp:if_first_image>...

as

<txp:image thumbnail='<txp:if_first_image not />' />...

Just love these little tricks of yours. Nice and succinct, though perhaps not as readable for a beginner to follow.


TXP Builders – finely-crafted code, design and txp

Offline

#17 2021-01-20 10:32:28

Gallex
Member
Registered: 2006-10-08
Posts: 1,331

Re: if individual article, if category, if section...

jakob wrote #328252:

… you’ll see that this code is only displayed if your URL contains a category (?c=… or an /section/category/ url scheme). txp:article is context-sensitive, so it will automatically filter by that category. That’s why you see it when you assign it to the category (like you did just now) and don’t see it when it’s assigned just to the section.

The solution is easy: swap out the context-sensitive txp:article for txp:article_custom:

yess!! thank you jakob and all others!
one more little problem – i get error on each category page:

Tag error:  ->  Textpattern Notice: Page template default does not contain a txp:article tag. while parsing form Ükski on page default
textpattern/publish.php:748 trigger_error()
index.php:74 textpattern()

Offline

#18 2021-01-20 10:48:49

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,218
Website GitHub

Re: if individual article, if category, if section...

Gallex wrote #328256:

one more little problem – i get error on each category page:

Tag error: -> Textpattern Notice: Page template default does not contain a txp:article tag. while parsing form Ükski on page default...

It’s just a notice (you have txp:article_custom there instead) and when you switch to live (and maybe testing too) it will disappear.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB