Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-03-01 06:19:38
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Sections, Categories and Articles
I’m relatively new to Textpattern and I’m trying to set my site up but cannot seem to get my site up the way I want.
My site will have the following SECTIONS
News, Sports, Entertainment,
Then I have the Following CATEGORIES
NEWS: – Local News, International News, Politics, Editorials, Columns
SPORTS: – Baseball, Basketball, Football, Soccer, Tennis, Track & Field
ENTERTAINMENT:- Music, Art, Movies
I would like to have my SECTIONS listed in a horizontal navigation. This I already have working just fine.
What I can’t figure out is how to get ONLY a list of my CATEGORIES when I click on a particular SECTION. Then whem I click on a particular CATEGORY, how to get ONLY the article title and post date for each article.
I have tried several ways including samples from here in the forum, but the only result I get when I click on the section name is the complete articles.
Can someone help me out, please.
MJ
Offline
#2 2009-03-01 20:04:24
- aeris
- Member
- Registered: 2009-03-01
- Posts: 12
Re: Sections, Categories and Articles
I’m new too and can’t figure out how to meaningfully “associate” a section with categories either. You can get a category list to display once with one tag. There are some plugins people have mentioned…
But this should work for displaying only titles and dates:
<txp:if_category>
<txp:article limit=“20”>
<p>
<txp:permlink><txp:title /></txp:permlink>
<br />
<txp:posted />
</p>
</txp:article>
</txp:if_category>
Add your own html, and use <txp:else /> if needed.
Offline
#3 2009-03-01 20:32:18
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Sections, Categories and Articles
Thanks for answering. I’ll check it out and post a response to let you know if it worked.
mj
Offline
#4 2009-03-01 21:24:30
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Sections, Categories and Articles
Offline
#5 2009-03-02 03:32:37
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Sections, Categories and Articles
No. Doesn’t help at all.
I just can’t seem to get the desired result I want here. I’m going to delete everything and start all over.
Hope I can figure it out this time…
Thanks anyway.
mj
Offline
#6 2009-03-02 05:27:58
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: Sections, Categories and Articles
jammer wrote:
No. Doesn’t help at all.
What doesn’t work for you?
It seems that Els’ suggestions
“name the parent category exactly like the section, for example ‘articles’, and create the child categories for it that should be displayed in section ‘articles’.”
… should do exactly what you want.
Offline
#7 2009-03-02 21:52:43
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Sections, Categories and Articles
Sorry, I’ve been at this for about 5-6 weeks now and it just doesn’t work. I’m trying to do a fresh install but now MYSQL won’t allow me to create any new databases or even drop or flush the old one.
I’ve installed POSTGRESQL and testing another CMS which works perfectly without a hitch.
I’m working on getting past this mysql hurdle and get Textpattern up and running as I find it much easier
to work with. Hopefully everything will work out.
Offline
#8 2009-03-07 07:27:23
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Sections, Categories and Articles
I did a completely clean install and got things up and running again.
Els, I did try the code from the link you gave me, but got a blank page.
I put the following code in
<txp:category_list label="Categories" this_section="1" />
This gave me a list of all my categories, not just the ones in the currently selected section.
ALSO, when I click on the Category tags at the end of articles in sections I create, I get a blank page instead of a listing of the articles in the Category.
How can I fix this..
Thanks again
mj
Offline
#9 2009-03-07 12:20:34
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Sections, Categories and Articles
jammer
What you need to do is create parent categories with exactly the same name as your sections: so if your sections are named news
, sports
, entertainment
, create the same categories. (Note that you can use capitals in category titles, but not in names!) Then:
- assign categories Local News, International News, Politics, Editorials, Columns to parent category News
- assign categories Baseball, Basketball, Football, Soccer, Tennis, Track & Field to parent category Sports
- assign categories Music, Art, Movies to parent category Entertainment
Then place this tag on your page template(s) that is/are used for your sections News, Sports and Entertainment:
<txp:category_list label="Categories" parent='<txp:section />' exclude='<txp:section />' this_section="1" />
What this does is display a list of linked categories that are children of the category with the same name as the section currently viewed, without the parent category itself.
I don’t know if you are using different page templates for each section, or one for all sections, but to display your articles when a category is clicked you need a <txp:article />
tag on the apropriate page template. Assuming you are using one page template for all sections, place this code where you want the articles to be displayed:
<txp:if_section name="news,sports,entertainment">
<txp:article form="default" listform="your-article-list-form" limit="99" />
</txp:if_section>
If you have a different page template for each section you don’t need the if_section tags, just place the article tag on each page.
Form ‘your-article-list-form’:
<txp:if_first_article><ul></txp:if_first_article>
<li><txp:permlink><txp:title /> - <txp:posted /></txp:permlink></li>
<txp:if_last_article></ul></txp:if_last_article>
Last edited by els (2009-03-07 12:23:43)
Offline
#10 2009-03-07 20:00:29
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Sections, Categories and Articles
Thanks Els.
Works ok so far. I still have some site building to do so I’ll definitely be calling out for your help.
I still can’t get the “Category1/Category2” links to show the article listing for the categories yet but i’m sowking on that too.
Thanks again
mj
Offline
#11 2009-03-07 20:47:45
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Sections, Categories and Articles
jammer wrote:
I still can’t get the “Category1/Category2” links to show the article listing for the categories yet
You can use this_section="1"
in <txp:category1 />
and <txp:category2 />
as well.
Offline
#12 2009-03-08 04:42:33
- jammer
- Member
- Registered: 2009-01-13
- Posts: 36
Re: Sections, Categories and Articles
Thanks again Els. Works just the way I want.
I have a few more Q’s for you if you don’t mind.
Is there a way (through plugins or code) to get a user signup form on the front page of the site, and then give them access to a form to allow them to post articles and assign them to a category ( something like a classified ad) without giving access to the admin area.
My understanding of the user permissions (I might be wrong) is that some users would have access to my admin area which I definitely do not want.
mj
Offline