Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-04-01 00:33:18
- gregology
- New Member
- Registered: 2007-04-01
- Posts: 1
not displaying null ;-)
G’day, I’m using textpattern as my travel blogging software and I am using the custom fields 1 and 2 as country and city so people know where I am. This is the code I’m currently using
[code]
<h3><txp:permlink><txp:title /></txp:permlink> · <txp:posted /></h3>
<p><txp:custom_field name=“city” />, <txp:custom_field name=“country” /></p>
<txp:body />
<p>— <txp:author /></p>
<txp:comments_invite wraptag=“p” />
<div><img src=”<txp:site_url />images/1.gif” width=“400” height=“1” class=“divider” alt=”—-” title=”“ /></div>
[/code]
What I want is the custom fields to display the last non null result. i.e. If I post from Perth, Australia and put Perth, Australia in the respective fields for a blog entry I want it to display Perth, Australia for every entry until I put a new place in those respective fields. The reason I want to do this is because I’ll be staying in some places for quite a while and continuously putting the city and country in is annoying.
Can any of you smart cookies help?
Regards
Greg.
Offline
Re: not displaying null ;-)
What about:
<txp:if_custom_field name="location">
<!--if you put something in the location field, display it-->
<txp:custom_field name="location" />
<txp:else />
<!--display perth, au-->
Perth, Australia
</txp:if_custom_field>
- location = custom field name
- caveat: once you’re in another place for awhile and change Perth to say Tokyo, the Perth entries won’t have Perth in their custom field.
Offline
#3 2007-04-01 02:57:55
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: not displaying null ;-)
TextBook: custom_field
<p><txp:custom_field name="city" default="Perth" />, <txp:custom_field name="country" default="Australia" /></p>
Offline
#4 2007-04-01 12:11:40
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: not displaying null ;-)
Wow, until now I failed to notice that, thanks Mary!
Offline
Re: not displaying null ;-)
Same here! I hadn’t looked at the custom field page since 2005. The more you know! :D
Offline
#6 2007-04-01 22:02:46
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Offline
Pages: 1