Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-06-03 21:52:28
- babyben
- Member
- Registered: 2007-06-03
- Posts: 39
Change the 'top' article of any category/section?
I’m sure this is something that the “sticky” article and the limit article to 1 should handle but I couldn’t get it work… (blush)
Q1: I want to have different categorys such as about (at domain.com/about/) with further pages inside this (domain.com/about/about-us or domain.com/about/location) but if you just visited www.domain.com/about/ you would get a custom page.
Q2: Separately I’d also like to know how to just list the titles (sortable??) of the posts available in that [about] category at the top of the category like domain.com/about
I hope that makes sense.. !!
Thanks. :)
Offline
#2 2007-06-03 21:57:18
- masa
- Member
- From: Asturias, Spain
- Registered: 2005-11-25
- Posts: 1,091
Re: Change the 'top' article of any category/section?
I think you might be better off by also using sections. There’s a somewhat related article with a solution employing sticky and live articles.
Does that help?
Offline
#3 2007-06-03 22:03:35
- babyben
- Member
- Registered: 2007-06-03
- Posts: 39
Re: Change the 'top' article of any category/section?
masa wrote:
I think you might be better off by also using sections. There’s a somewhat related article with a solution employing sticky and live articles.
I thought I had the wrong word – replace category in my post above with section!
Basically I want to list (Q1) all the section articles in the “section frontpage” and on other sections (Q2) be able to have a “custom section frontpage)
Sorry if my posts are confusing!
Offline
Re: Change the 'top' article of any category/section?
Q1: use the section/article medaphoar. “about” would be the section, “location” is an article in that section. to get the link scheme in the form of /about/location, select “section/title” as permanentlink-mode in your preferences. (if this link scheme is only wanted in particular sections, then gbp_permanent_links is your friend.)
Q2: you can make a list of the titles very easily by applying a different form. <txp:article form="titlesOnly" />
, then create a form titlesOnly
of type “article”. inside you’d probably want something like this: <txp:permlink><txp:title /></txp:permlink>
. the easiest way to make it sortable (you mean on the backend, right?) would be to use the timestamp of the article which would be ok in this case, as the articles are used rather static anyway.
as for the different section frontpage formatting: <txp:if_article_list> everything that you want to see on /about goes here <txp:else /> different formatting for /about/location (etc) goes here</txp:if_article_list>
. of course, you could achieve this in other ways as well but this is a starting point. you also might be interested in glx_if, which gives you a if_section_frontpage
conditional.
Offline
Re: Change the 'top' article of any category/section?
If article list (i.e. on the about page) show the sticky article. Do not link the title to any other page. That way the about page only shows on the About index.
If article page, show the article.
In the sidebar, list all articles in the about section, except for the sticky article. Link them all to their pages. When the user clicks, it’ll run the “if article page” of the code and show the articles, and not the sticky.
Example here: [url=http://djhellion.com/about]http://djhellion.com/about[/url]
——- if article list/ if indiv article code ——-
<txp:if_article_list>
<txp:article limit=1 status=“sticky” allowoverride=“1” form=“article-static” />
</txp:if_article_list>
<txp:if_individual_article>
<txp:article allowoverride=“1” form=“article-static” />
</txp:if_individual_article>
——- sidebar article list (I hardlink the About index in the sidebar to ease navigation. The list that follows it is the list of articles in the About section) ——-
<h3><a href=”/about”>About the girl</a></h3>
<br />
<txp:article_custom allowoverride=“1” form=“article-item-list” limit=“7” pgonly=“0” section=“about” sort=“Posted asc” />
Offline
#6 2007-06-17 16:39:37
- babyben
- Member
- Registered: 2007-06-03
- Posts: 39
Re: Change the 'top' article of any category/section?
I tried this (the above post) and it threw an error about not knowing a “article-static” form :(
I basically want to show a sticky at the top of a section. I’ve sussed the permalink domain.com/section/article thing.
Just can’t get any code to work :( It’s so bloomin’ simple. :(
Last edited by babyben (2007-06-17 16:40:03)
Offline
Re: Change the 'top' article of any category/section?
babyben wrote:
I tried this (the above post) and it threw an error about not knowing a “article-static” form :(
You need to have one. See in presentation->form
Offline
#8 2007-06-17 17:01:40
- babyben
- Member
- Registered: 2007-06-03
- Posts: 39
Re: Change the 'top' article of any category/section?
Would the article static just be the same as the default form?
Offline
#9 2007-06-17 17:16:19
- babyben
- Member
- Registered: 2007-06-03
- Posts: 39
Re: Change the 'top' article of any category/section?
I tried this on the default page template:
<txp:if_article_list> <!— section page: display the sticky article —> <txp:article status=“sticky” limit=1 /> <txp:else /> <!— article page: display the live article —> <txp:article limit=1 /> </txp:if_article_list>
.. and it displays the sticky article perfectly. But when you click on the title (i.e. to read the sticky article) nothing appear.
Offline
#10 2007-06-18 21:01:19
- babyben
- Member
- Registered: 2007-06-03
- Posts: 39
Re: Change the 'top' article of any category/section?
It’s me again.. managed to sort the problem – I don’t need the heading linked, so took the links off and it works (albeith a hackney method!)
Thank to all for help, it’s appreciated. :)
Offline