Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2009-06-27 20:45:26
- matthijs
- Member
- Registered: 2008-12-15
- Posts: 32
Re: Which page and tags are used to display categories
Like I said: article_custom can be finetuned extremely well.
E.g. with more (comma separated) categories.
You are right, but in this case I don’t want to have to hardcode all categories in there, as they might be changed and there will be added more. I’ll remember it in case I do need it some day
Els wrote:
Maybe you will understand them then, but the rest of us will be just as confused as you are now… ;)
maybe you are right, it’s perfect already, don’t change anything :)
Anyway, thanks for all the assistance so far, without your help I would have lost even more hair by now
Offline
#14 2009-06-27 22:02:01
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Which page and tags are used to display categories
matthijs wrote:
I don’t want to have to hardcode all categories in there
As long as txp:category_list doesn’t come with a link=“0” attribute we have to work with the one txp:category offers.
Where you need the list of categories, use <txp:category_list exclude="whatever" break=", " form="cat_as_text" />
, your form cat_as_text containing just <txp:category />
which silently contains link="0"
, the tag’s default.
Last edited by uli (2009-06-27 22:19:31)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#15 2009-06-28 07:41:22
- matthijs
- Member
- Registered: 2008-12-15
- Posts: 32
Re: Which page and tags are used to display categories
As long as txp:category_list doesn’t come with a link=“0” attribute we have to work with the one txp:category offers.
@Uli: I am not sure what you are trying to say?
What I use now, and what seems to work, is Els’ code. This is what I have in my “project archive” page:
<txp:if_category>
<!-- this is page /projects/?c=category-name -->
<txp:article_custom section="projects" category='<txp:category />' wraptag="ul" break="li">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
<txp:else />
<txp:category_list parent="projects" section="projects-archive" exclude="projects" break="li" wraptag="ul" />
</txp:if_category>
This is what I have in my home page (that’s my default page/template):
<txp:if_category>
<!-- this is page /category/category-name -->
<div id="content">
<txp:article_custom section="projects" category='<txp:category />' wraptag="ul" break="li">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</div>
<txp:else />
<!-- this is the actual front page -->
<div id="home">
<!-- more home page specific stuff -->
</div>
</txp:if_category>
And then finally this is what I have in my projects page
<txp:article form="default" limit="1" />
The only problem (?) I have is that I get this warning when visiting /projects-archive/:
Tag error: -> Textpattern Notice: Page template projects-archive does not contain a txp:article tag on line 504
textpattern/publish.php:504 trigger_error()
index.php:33 textpattern()
It all feels a bit hackerish, and I’m not finished yet as I also have to create some sidebar menu’s on those pages/urls displaying specific items for each page (ahum, meaning webpage/URL, not txp page). But I’m a lot farther now.
In a normal situation, I would just do something like:
mysite.com/
mysite.com/projects/
mysite.com/projects/castles/
mysite.com/projects/castles/some-castle-project
But I’m afraid I would have to rely on htaccess rewrite rules to get that done in txp (as far as I know), something I’d rather not do, considering future maintainance
Offline
#16 2009-06-28 11:31:52
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Which page and tags are used to display categories
matthijs wrote:
The only problem (?) I have is that I get this warning when visiting /projects-archive/:
The warning won’t be there when you set production status to ‘live’. A workaround is to add <txp:article pgonly="1" limit="1" />
somewhere on your page template for section projects-archive. It won’t display anything, but it will get rid of the warning.
BTW you can have URLs like /section-name/category-name/ and /section-name/category-name/article-title/ with the plugin gbp_permanent_links.
Offline
#17 2009-06-28 11:59:52
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Which page and tags are used to display categories
matthijs wrote:
uli wrote: As long as txp:category_list doesn’t come with a link=“0” attribute we have to work with the one txp:category offers.
@Uli: I am not sure what you are trying to say?
A tag’s link attribute set to 0 makes it output plain text where it would otherwise render “linked” text.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline