Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-25 03:10:30

deronsizemore
Member
From: Kentucky
Registered: 2005-11-02
Posts: 324

Trying to understand custom fields

I keep reading that custom fields are GREAT!! But I’ve never used them and couldn’t tell you how to use them. I’m trying to learn, and so far this is the only like I’ve come up with: <a href=“http://textpattern.net/wiki/index.php?title=Txp:custom_field_/”>http://textpattern.net/wiki/index.php?title=Txp:custom_field_/</a>

In that link it says you could use this for custom fields: <txp:custom_field name="Author" />: <txp:custom_field name="Title" /> but I’m confused on how that code would output J.R.R. Tolkien: The Lord of the Rings? How do you specify what each custom field outputs? Like what I’m confused on, if I go to the admin>custom fields section and then in Custom Field 1 name and type “author”, that is the name of my custom field, so how do I specify that when I use that custom field tag, it would output Deron Sizemore?

Last edited by deronsizemore (2006-08-25 03:11:00)

Offline

#2 2006-08-25 04:06:01

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Trying to understand custom fields

Yeah, they are a bit cofusing at first, but they are quite useful (I use them for outputting a site URL for my portfolio and also for issue numbers on another site).

You are right in that “author” would be the name of the custom field. That’s step 1, and alone, it won’t do anything. Next, go to whichever form you want to display the info in, and use <txp:custom_field name="author" />. This will look for whatever value you post in the article. Next, back in Content>Write, post an article with a value for the author field (Click advanced options). That should do it for you.

You can use conditionals too. I use them on Proweb.cc to output the article-author bio, since if_author doesn’t work in our version. It’s pretty simple:

<code>
<h3>About the Author</h3>
<txp:if_custom_field name=“author” val=“dave”> <txp:output_form form=“author_dave” />//output a specific form, though the content could’ve been here
</txp:if_custom_field>
</code>

Offline

#3 2006-08-25 11:39:06

deronsizemore
Member
From: Kentucky
Registered: 2005-11-02
Posts: 324

Re: Trying to understand custom fields

Ahhh Hah! lol. I get it now. I just didn’t know where to specify what value “author” would output. I kept looking on the Admin page going “WHAT THE HECK!!, WHERE IT IS AT?” lol. Yeah, those could come in handy now that I know how to use them. :) Thanks.

Offline

Board footer

Powered by FluxBB