Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-02-22 11:50:06
- smo
- New Member
- Registered: 2004-04-25
- Posts: 5
List of postings of a specific cartegory in different section
Hey Guys!
First of all, I’d like to say that i really like textpattern. It has never let me down since I began using it in 2004. But now I came across a problem which is really giving me a headache.
I basically have two section on my site: the default section and a photoblog section (both of which have their own page, forms and styles). I publish photos in the photoblog section each as an article, that is not visible on the default section. All works well. But now I want to categorize the posted ‘photo articles’, so I can get a list of similar photos. But when I do this the straight forward way, just using the txp categories right away, i got two problems: 1) since the ‘photo categories’ are categories like any other, they show up in the category list on the default page and 2) when i create a txp:category link=y in the photoblog section it tries to show the appropriate photo postings in the default page, not in the photoblog page. But since i posted it in the photoblog section, it is not show on the default section. That’s basically as intended, but i just want to show the photo postings in a different page than the default one.
Gee, this sound really complicated, I hope I could get the problem across. Two approaches come to mind: 1) Is it possible to categorize categories (Maybe using a plugin)? That way I could distinguish photo categories and article categories. 2) Can i tell the txp:category tag (or a some similar plugin) to show the posting list in a specific section?
Thanks a bunch in advance.
Stephan
Offline
Re: List of postings of a specific cartegory in different section
You could generate URL like /photoblog/?c=category
, it work.
Or, you could create an article
section ‘or whataver), put your default content in it, and use the default section as a frontpage and a way of displaying any content (that’s the original intent of use of TXP).
Offline
#3 2006-02-22 12:37:36
- smo
- New Member
- Registered: 2004-04-25
- Posts: 5
Re: List of postings of a specific cartegory in different section
Thanks for the quick answer Jeremie. That did not quite solve my problem, but i inspired me to look at the problem from another angle.
Still I seem to have a challange here of only displaying a certain set of categories on the main page and the other categories in the photoblog section.
cheers,
Stephan
Offline
Re: List of postings of a specific cartegory in different section
Well, you can try txp:article_custom category="..."
.
Offline
#5 2006-02-22 13:00:23
- smo
- New Member
- Registered: 2004-04-25
- Posts: 5
Re: List of postings of a specific cartegory in different section
That would display articles based on their category. But i want the categories themselves being displayed. Like in txp:category_list wraptag=… The resulting list from this tag gives me every category because I cannot label categories as being for a different purpose (article/photo). A quick solution would be to Manually generate the category lists and not using txp:category, which be a bit ugly though, because I had to change the page every time i introduce a new category…
Offline
Re: List of postings of a specific cartegory in different section
The “default” section is the problem here so I’ll deal with it last.
For your “photoblog” section categories you can use the “if_different” and “article_custom” tags. Create a new FORM template called say “photocats” with this code:-
<code><txp:if_different>
<li class=“className”><a href=”<txp:site_url /><txp:section />/?c=<txp:category1 />”><txp:category1 title=1 /></a></li>
</txp:if_different></code>
<br />
This will extract ALL of your categories and link them but use a little trick of mine to pick up the section you are currently viewing and use that section, and thus it’s templates, to show the category listing when the link is selected.
Now wherever it is that you want to display this list use this:-
<code>
<ul>
<txp:article_custom form=“photocats” limit=“9999” section=“photoblog” sortby=“Category1,Category2” sortdir=“desc” />
</ul></code>
<br />
That should now just list those categories in the “photoblog” section. Make sure you have the correct names in “form” and “section”. You may need to adjust “sortby” and “sortdir” to your own taste.
The “default” section is a pain and I can only think that you may need to hand code it, but once it’s done…
If you use a common sidebar for both sections try using the <code><txp:if_section name=“sectionName”></txp:if_section></code> tags around the two blocks of code so that only one of them appears.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#7 2006-02-22 13:27:47
- smo
- New Member
- Registered: 2004-04-25
- Posts: 5
Re: List of postings of a specific cartegory in different section
Stuart, your solution works like a charm. I’m in your debt. :) Thanks a lot. One problem’s remaining though: Is there a way to get a LINK to the latest post of a particular section? I want to have a link on the main page to the photoblog and want to get to the latest posting directly.
cheers
Stephan
Offline
Re: List of postings of a specific cartegory in different section
<code><txp:article_custom section=“photoblog” form=“formName” limit=“1” /></code> should give you the latest article from the photoblog section and you need to create a new FORM template to just display the article’s title with a link so something like <code><txp:permlink><txp:title /></txp:permlink></code> and you will need to add whatever HTML tags you require.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#9 2006-02-22 14:14:51
- smo
- New Member
- Registered: 2004-04-25
- Posts: 5
Re: List of postings of a specific cartegory in different section
Yay! You’re my hero. The power of forms, right? ;) All works well now. Must still do a little tweaking, but I’m impressed with the functionality so far.
Stuart and Jeremie, your help was much appreciated, thanks again.
Offline
Re: List of postings of a specific cartegory in different section
No problem. :)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline