Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2017-08-31 14:02:54

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

Re: txp:article_custom via php echo

zenman wrote #306785:

The idea with category url = article url is good. But I stumbled over breadcrumbs with it. And one more thing, you cannot see an article url without opening it which takes some time. How do you know where the parent China article is if there is several articles with China in the title, for example. You have to open it and look at its url. But to see an article id is easier because they are listed one by one in the Articles panel.

Performance-wise, ID is better than url because it’s a primary index of textpattern table. Nevertheless, the whole ID=Category1 thing feels wrong. In 4.7 <txp:breadcrumb /> is more flexible and categories could suffice for your needs. If you can wait, of course :-)

Offline

#26 2017-08-31 14:58:49

zenman
Member
Registered: 2017-08-28
Posts: 41
Website

Re: txp:article_custom via php echo

etc wrote #306797:

Performance-wise, ID is better than url because it’s a primary index of textpattern table. Nevertheless, the whole ID=Category1 thing feels wrong. In 4.7 <txp:breadcrumb /> is more flexible and categories could suffice for your needs. If you can wait, of course :-)

can’t wait to see. will categories suffice for the whole parent-child issue dusscussed here or just <txp:breadcrumb /> part ?
i usually use categories for admin purposes to sort out articles – featured, children, homepage. they are not indexed by google and not accessible by front-end users unless it is a standard blog.

Last edited by zenman (2017-08-31 15:08:19)

Offline

#27 2017-08-31 15:35:11

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

Re: txp:article_custom via php echo

I would follow this:

makss wrote #306779:

For example, a category tree can be:

country
	china
		lcl
		...
	hongkong
	europe
	...

and assign each concerned article two categories (Category1, Category2):

  • parents (countries): (country, china) etc
  • children (services): (china, lcl)

Then a service-by-country list can be output with

<!-- list of parent articles (countries) -->
<txp:article_custom category="country" match="Category1" wraptag="ul" class="Parent-Articles" break="li">
    <txp:permlink><txp:title /></txp:permlink>

    <!-- list of child articles if Category2 is the same as parent Category1. -->
    <txp:article_custom category='<txp:category2 />' match="Category1" wraptag="ul" class="Child-Articles" break="li">
      <txp:permlink><txp:title /></txp:permlink>
    </txp:article_custom>

</txp:article_custom>

IIRC, match was introduced in 4.6, so you can test it. The advantage for users is that the category tree is available on Write tab, and one does not need to create ID-named categories. Actually, even <txp:category_list /> could do, I think.

Edit: it’s just a more standard approach, not necessary a cuter one.

Offline

Board footer

Powered by FluxBB