Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Best way to create single article landing page for section
Rather than displaying a list of all articles I would like to display one specific article when the URL indicates a specific section without any category modifier. That article will display a page with jumping off points to other categories within the section.,
What is the best way to conditionally test that the URL is indicating an entire section without category or article specified so I can conditionally display the specific landing article for the section.
Thanks!
-Mark
Last edited by mericson (2009-09-10 04:25:42)
Offline
Re: Best way to create single article landing page for section
there are native ways but I normally opt for the easy one:)
glx_if plugin provides a tag which detects the section’s ‘front’ page. Using the plugin I would do something like:
<txp:if_section name="about">
<txp:glx_if_section_frontpage>
<txp:article_custom id="5">
<txp:body />
</txp:article_custom>
<txp:else />
<txp:article />
</txp:glx_if_section_frontpage>
</txp:if_section>
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: Best way to create single article landing page for section
That looks perfect, but unfortunately the download is no longer available.
Last edited by mericson (2009-09-10 04:56:05)
Offline
Re: Best way to create single article landing page for section
My working example with no plugins:
<txp:article form="landing" status="sticky" />
<txp:article form="report" listform="metadata" />
If you will adapt article_custom id="1"
as in Yiannis’ example, you probably should switch its status to hidden to avoid duplicated contents.
Offline
Re: Best way to create single article landing page for section
mericson wrote:
That looks perfect, but unfortunately the download is no longer available.
here you are:)
YToxMDp7czo0OiJuYW1lIjtzOjY6ImdseF9pZiI7czo2OiJhdXRob3IiO3M6MTM6IkpvaGFuIE5pbHNzb24iO3M6MTA6ImF1dGhvcl91cmkiO3M6MjU6Imh0dHA6Ly9qb2hhbi5nYWxheGVuLm5ldC8iO3M6NzoidmVyc2lvbiI7czozOiIwLjciO3M6MTE6ImRlc2NyaXB0aW9uIjtzOjIxOiJTb21lIGNvbmRpdGlvbmFsIHRhZ3MiO3M6NDoiaGVscCI7czo3MDI1OiI8aDE+Z2x4X2lmPC9oMT4KCgk8cD5UaGlzIHBsdWdpbiBjb21lcyB3aXRoIDExIGRpZmZlcmVudCBjb25kaXRpb25hbCB0YW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Il0gPT0gImRlZmF1bHQiICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbXB0eSgkcHJldGV4dFsiYyJdKSAmJgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHkoJHByZXRleHRbInEiXSkgJiYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVtcHR5KCRwcmV0ZXh0WyJwZyJdKSkpOwp9CgpmdW5jdGlvbiBnbHhfaWZfbm90X2Zyb250cGFnZSgkYXR0cywgJHRoaW5nKQp7CiAgICBnbG9iYWwgJHByZXRleHQ7CiAgICByZXR1cm4gcGFyc2UoRXZhbEVsc2UoJHRoaW5nLCAkcHJldGV4dFsicyJdICE9ICJkZWZhdWx0IiAmJgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHkoJHByZXRleHRbImMiXSkgJiYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVtcHR5KCRwcmV0ZXh0WyJxIl0pICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbXB0eSgkcHJldGV4dFsicGciXSkpKTsKfQoKZnVuY3Rpb24gZ2x4X2lmX3NlY3Rpb25fZnJvbnRwYWdlKCRhdHRzLCAkdGhpbmcpCnsKICAgIGdsb2JhbCAkcHJldGV4dCwgJGlzX2FydGljbGVfbGlzdDsKICAgIHJldHVybiBwYXJzZShFdmFsRWxzZSgkdGhpbmcsIGVtcHR5KCRwcmV0ZXh0WyJjIl0pICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaXNfYXJ0aWNsZV9saXN0ID09IHRydWUpKTsKfQoKZnVuY3Rpb24gZ2x4X2lmX25vdF9zZWN0aW9uX2Zyb250cGFnZSgkYXR0cywgJHRoaW5nKQp7CiAgICBnbG9iYWwgJHByZXRleHQsICRpc19hcnRpY2xlX2xpc3Q7CiAgICByZXR1cm4gcGFyc2UoRXZhbEVsc2UoJHRoaW5nLCAhZW1wdHkoJ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yZWNvbW1lbnRzOiBJZiB0aGlzIGlzIHNldCB0byBmYWxzZSB0aGUgcGx1Z2luIHdpbGwgaW5nbm9yZSBhbnkKY29tbWVudHMsIGlmIHNldCB0byB0cnVlIHRoZSB0ZXh0IHdpbGwgb25seSBzaG93IGlmIHRoZXJlIGlzIG5vCmNvbW1lbnRzIGFscmVhZHkuIEl0IGlzIGZhbHNlIGFzIGRlZmF1bHQKKi8KZnVuY3Rpb24gZ2x4X2lmX2NvbW1lbnRzX2Nsb3NlZCgkYXR0cywgJHRoaW5nKQp7CiAgICBpZiAoaXNfYXJyYXkoJGF0dHMpKSBleHRyYWN0KCRhdHRzKTsKICAgIGdsb2JhbCAkdGhpc2FydGljbGU7CiAgICAkaWdub3JlQ29tbWVudHMgPSAoZW1wdHkoJGlnbm9yZWNvbW1lbnRzKSkgPyBmYWxzZSA6IHRydWU7CiAgICAkaWQgPSAkdGhpc2FydGljbGVbInRoaXNpZCJdOwogICAgJG91dHB1dCA9ICIiOwogICAgJHJzID0gc2FmZV9yb3coIioiLCAidGV4dHBhdHRlcm4iLCAiSUQ9ICRpZCBBTkQgQW5ub3RhdGU9MCIpOwogICAgaWYgKCRycykKICAgIHsKICAgICAgICBpZiAoJGlnbm9yZUNvbW1lbnRzKQogICAgICAgIHsKICAgICAgICAgICAgJHJzMiA9IHNhZmVfcm93KCJDT1VOVCggZGlzY3Vzc2lkICkgQVMgbnVtX29mX2NvbW1lbnRzIiwgInR4cF9kaXNjdXNzIiwgInBhcmVudGlkID0gJGlkIik7CiAgICAgICAgICAgIGlmICgkcnMyKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpZiAoJHJzMlswXSA9PSAwKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICRvdXRwdXQgPSBwYXJzZSgkdGhpbmcpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGVsc2UKICAgICAgICB7CiAgICAgICAgICAgICRvdXRwdXQg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XQgPSBwYXJzZSgkdGhpbmcpOwogICAgICAgIGJyZWFrOwogICAgICAgIGNhc2UgIm5vdF9lcXVhbF90byI6CiAgICAgICAgICAgIGlmKCR2YWx1ZSAhPSAkdGhpc2FydGljbGVbJ2NvbW1lbnRzX2NvdW50J10pCiAgICAgICAgICAgICAgICAkb3V0cHV0ID0gcGFyc2UoJHRoaW5nKTsKICAgICAgICBicmVhazsKICAgICAgICBjYXNlICJsZXNzX3RoYW4iOgogICAgICAgICAgICBpZiAoJHZhbHVlIDwgJHRoaXNhcnRpY2xlWydjb21tZW50c19jb3VudCddKQogICAgICAgICAgICAkb3V0cHV0ID0gcGFyc2UoJHRoaW5nKTsKICAgICAgICBicmVhazsKICAgICAgICBjYXNlICJncmVhdGVyX3RoYW4iOgogICAgICAgICAgICBpZiAoJHZhbHVlIDwgJHRoaXNhcnRpY2xlWydjb21tZW50c19jb3VudCddKQogICAgICAgICAgICAkb3V0cHV0ID0gcGFyc2UoJHRoaW5nKTsKICAgICAgICBicmVhazsKICAgICAgICBjYXNlICJsZXNzX3RoYW5fb3JfZXF1YWxfdG8iOgogICAgICAgICAgICBpZiAoJHZhbHVlIDw9ICR0aGlzYXJ0aWNsZVsnY29tbWVudHNfY291bnQnXSkKICAgICAgICAgICAgJG91dHB1dCA9IHBhcnNlKCR0aGluZyk7CiAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAiZ3JlYXRlcl90aGFuX29yX2VxdWFsX3RvIjoKICAgICAgICAgICAgaWYgKCR2YWx1ZSA+PSAkdGhpc2FydGljbGVbJ2NvbW1lbnRzX2NvdW50J10pCiAgICAgICAgICAgICRvdXRwdXQgPSBwYXJzZSgkdGhpbmcpOwogICAgICAgIGJyZWFrOwogICAgfQoKICAgIHJldHVybiAkb3V0cHV0Owp9CgpmdW5jdGlvbiBnbHhfaWZfaW1hZ2VfZGlzcGxheSgkYXR0cywgJHRoaW5nKQp7CiAgICBnbG9iYWwgJHA7CiAgICByZXR1cm4gcGFyc2UoRXZhbEVsc2UoJHRoaW5nLCAhZW1wdHkoJHApKSk7Cn0KZnVuY3Rpb24gZ2x4X2lmX25vdF9pbWFnZV9kaXNwbGF5KCRhdHRzLCAkdGhpbmcpCnsKICAgIGdsb2JhbCAkcDsKICAgIHJldHVybiBwYXJzZShFdmFsRWxzZSgkdGhpbmcsIGVtcHR5KCRwKSkpOwp9CiI7czo0OiJ0eXBlIjtzOjE6IjAiO3M6NToib3JkZXIiO3M6MToiNSI7czozOiJtZDUiO3M6MzI6IjA4MmFjZmZiM2UyMjAyYmM0M2M1YzUzNGIzNzU1N2I5Ijt9
But as Vladas said, if you can acheive a satisfactory result without a plugin, it is always better
Last edited by colak (2009-09-10 10:59:45)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#6 2009-09-10 17:54:07
- tennapel
- Member
- Registered: 2009-05-31
- Posts: 62
Re: Best way to create single article landing page for section
Unless I don’t interpret the question correct, I would do it like this:
<txp:if_category> <txp:article /> <txp:else /> <txp:output_form form="category_list" /> </txp:if_category>
Offline
Re: Best way to create single article landing page for section
Your example seems very intriguing. I hadn’t thought about using sticky articles. However, I don’t understand exactly how what you demonstrated conditionally works to display only the ‘sticky’ article when it is the section home and operates normally others? Perhaps I’m missing something…
Vienuolis wrote:
My working example with no plugins:
<txp:article form="landing" status="sticky" />
<txp:article form="report" listform="metadata" />
If you will adapt article_custom id="1"
as in Yiannis’ example, you probably should switch its status to hidden to avoid duplicated contents.
Offline
#8 2009-09-10 21:32:34
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Best way to create single article landing page for section
<txp:if_article_list>
<txp:if_category><!-- a category page -->
<txp:article limit="123" form="your-article-list-form" />
<txp:else /><!-- the section landing page -->
<txp:article status="sticky" limit="1" form="your-sticky-article-form" />
</txp:if_category>
<txp:else /><!-- an individual article page -->
<txp:article form="your-single-article-form" />
</txp:if_article_list>
If you are using a page template for more than one section, wrap this entire block in <txp:if_section name="your-section">
tags.
Last edited by els (2009-09-10 21:33:47)
Offline
Re: Best way to create single article landing page for section
Sticky status hides that article anywhere because of default <txp:article status="live" />
. Thus this sticky will not appear as individual article by form="report"
nor will be listed on the section by form="metadata"
. The sticky article will only stand as the section’s caption by form="landing"
, which might contain only <h1><txp:title /></h1><txp:body />
.
Offline
Re: Best way to create single article landing page for section
Thanks,
But then wouldn’t the subsequent <txp:article form=“report” listform=“metadata” /> list all the articles after the sticky one(s)? I guess my question was more, how do I not display the additional articles in the section?
Vienuolis wrote:
Sticky status hides that article anywhere because of default
<txp:article status="live" />
. Thus this sticky will not appear as individual article byform="report"
nor will be listed on the section byform="metadata"
. The sticky article will only stand as the section’s caption byform="landing"
, which might contain only<h1><txp:title /></h1><txp:body />
.
Offline
Re: Best way to create single article landing page for section
Hmmm… is it the case that if the first <txp:article …> tag matches (the sticky) the second one is skipped?
mericson wrote:
Thanks,
But then wouldn’t the subsequent <txp:article form=“report” listform=“metadata” /> list all the articles after the sticky one(s)? I guess my question was more, how do I not display the additional articles in the section?
Vienuolis wrote:
Sticky status hides that article anywhere because of default
<txp:article status="live" />
. Thus this sticky will not appear as individual article byform="report"
nor will be listed on the section byform="metadata"
. The sticky article will only stand as the section’s caption byform="landing"
, which might contain only<h1><txp:title /></h1><txp:body />
.
Offline
Re: Best way to create single article landing page for section
Sorry, I did not quite delve into your goal. Please accept my apologies and Els’ code — it should meet your task exactly.
Last edited by Vienuolis (2009-09-11 10:57:00)
Offline