Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-06-01 21:39:08
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Custom fields and article lists
I can’t really find an elegant way around this, so I thought I’d ask you guys.
I’m in a situation where I need the meta title coming from custom field. I use this code…
<title><txp:custom_field name="meta-title" /> | <txp:section title="1" /> | <txp:sitename /></title>
…which works fine for individual articles but fails on the article list. The article lists are all just a single static page I need the custom field bit too. Is there a way to use custom fields outside of the article tag on an article list?
Otherwise I will have to use this method…
<title><txp:if_individual_article><txp:custom_field name="meta-title" /><txp:else /> <txp:output_form form="section_titles" />|</txp:if_individual_article> <txp:section title="1" /> | <txp:sitename /></title>
And then a load of conditionals in that form which isn’t quite a elegant.
Last edited by FireFusion (2007-06-01 21:39:32)
Offline
#2 2007-06-02 08:30:38
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Custom fields and article lists
Is there a way to use custom fields outside of the article tag on an article list?
No. Those wouldn’t be article custom fields then, right?
And then a load of conditionals in that form which isn’t quite a elegant.
That would be the price you pay for using the same page template for each section: you either have a separate page for each section or use conditionals.
The best way, though, would likely be a plugin.
Offline
#3 2007-06-04 04:35:51
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Re: Custom fields and article lists
Well I found my solution in the Textpattern Solutions (good choice of title). Since my static pages just show one sticky article I only had to do this…
<txp:if_individual_article>
<txp:article form="metadata" />
<txp:else />
<txp:article limit="1" status="sticky" form="metadata" />
</txp:if_individual_article>
Last edited by FireFusion (2007-06-04 04:36:05)
Offline
#4 2007-06-08 11:31:02
- alannie
- Member
- From: Minnesota, USA
- Registered: 2005-09-15
- Posts: 150
Re: Custom fields and article lists
Here’s a variant of the solution. I’m curious, are you using multiple instances of the txp:article tag? Is it causing the issues mentioned in the other thread?
Offline
#5 2007-08-25 18:13:35
- Logoleptic
- Plugin Author
- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Re: Custom fields and article lists
alannie wrote:
Here’s a variant of the solution. I’m curious, are you using multiple instances of the txp:article tag? Is it causing the issues mentioned in the other thread?
I ran across the technique mentioned by FireFusion earlier this year on Performancing. I did run into a little trouble when I tried to implement it on my site, but adding allowoverride="0"
to the <txp:article />
tag fixed things. Works like a charm now.
Offline
Pages: 1