Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
attributes for article_custom
I don’t know how hard it would be to achieve but is there a chance we can have customfieldvalue="value here"
as an additional attribute for article_custom?
Although I know that this can be done with a plugin but having it part of the core would be nice.
This will help in further customising the output of article lists and individual articles.
A caveat may be that this will affect site speeds as it would probably require searching the custom_fields tables.
>Edit
A usage example would be
<txp:article_custom customfieldname="genre" customfieldvalue="science fiction" />
Last edited by colak (2008-08-03 07:05:31)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: attributes for article_custom
colak wrote:
<txp:article_custom customfieldname="genre" customfieldvalue="science fiction" />
Yiannis, we do have <txp:article_custom genre="science fiction" />
;-)
Offline
Re: attributes for article_custom
wet wrote:
Yiannis, we do have
<txp:article_custom genre="science fiction" />
;-)
Glad you got the joke:)
I was just thinking, would the above be possible with the new nested tags parser and the new txp:variable
?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: attributes for article_custom
If you are using a custom field then you wouldn’t need the variable tag. You could simply use something like <txp:article_custom category='<txp:custom_field name="genre" />' />
or change that to section if it’s a section rather than a category but I’m trying to figure out where you might want to use this as the variable tag can add a lot more flexibility in different situations. A lot depends on your usage.
Last edited by thebombsite (2008-08-03 17:11:18)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: attributes for article_custom
maybe my example was wrong.
Custom fields can be used to store many different kinds of data such as real (as opposed to posted) dates of articles, names, locations etc. These data might have some repetitions across articles but not enough to create a category or a section for it.
So examples for sites might be
<txp:article_custom section="events" category="perfomances" customfieldname="venue" customfieldvalue="royal festival hall" />
or/and
<txp:article_custom section="events" customfieldname="location" customfieldvalue="United Kingdom" />
the said article could go under “Performances” section and/or category
the resulting output would be all events published for “royal festival hall” and all events published which would take place in the UK.
>Edited for clarity
Last edited by colak (2008-08-03 17:55:02)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#6 2008-08-03 17:34:09
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: attributes for article_custom
What’s wrong with <txp:article_custom section="events" location="United Kingdom" />
?
Offline
Re: attributes for article_custom
Els wrote:
What’s wrong with
<txp:article_custom section="events" location="United Kingdom" />
?
Hi Els,
how would txp know where to fetch “location” from?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#8 2008-08-03 18:18:10
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: attributes for article_custom
colak wrote:
how would txp know where to fetch “location” from?
colak,
in the textbook entry for <txp:article_custom> there is this attribute among the others:
——————————————-
customfieldname=“value”
Restrict to articles with specified value for specified custom field name.
Replace “customfieldname” with the name of the custom field. Default is unset
——————————————-
so to answer your question txp will look in the textpattern table to check if there is a custom field named “location” and then will output all articles that meet the condition
Last edited by redbot (2008-08-03 18:20:24)
Offline
#9 2008-08-03 18:48:09
- Neko
- Member
- Registered: 2004-03-18
- Posts: 458
Re: attributes for article_custom
redbot wrote:
so to answer your question txp will look in the textpattern table to check if there is a custom field named “location” and then will output all articles that meet the condition
Awesome, I didn’t know that. Els and redbot FTW! :)
Offline
Re: attributes for article_custom
Neko wrote:
Awesome, I didn’t know that. Els and redbot FTW! :)
Ditto! I’m changing the title and I’m moving this to the “how do I forum”. Thanks so much!
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: attributes for article_custom
colak wrote:
wet wrote:
> Yiannis, we do have<txp:article_custom genre="science fiction" />
;-)Glad you got the joke:)
Well, this is what I meant. No joking…
Offline
Re: attributes for article_custom
Hi wet, yep… working on it now. thank you all for all the help.
Last edited by colak (2008-08-04 12:44:04)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Pages: 1