Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-05-21 20:13:43

ploinkr
Member
From: Montreal
Registered: 2007-12-06
Posts: 83

Custom field giving no output :-/

Hi there,
I’m having problems right now outputting the content of a certain custom field for some reason I just can’t figure out.

Here’s the code I’m using:
<div> <txp:article_custom clues="texts" LastName="<txp:custom_field name="LastName"/ >" form="lofi_texts" /> <p><small>&copy; Centre des arts actuels Skol &amp; <txp:custom_field name="Author" /></small></p> </div>

The problem field is Author, which I also changed to other names (Auteur, in French, Auteur_e, etc…) but to no avail.
The weird thing is, I changed the field in the code above for another one and it’s working perfectly!!
If anyone can help, I’m really baffled here….!

Offline

#2 2009-05-21 21:14:35

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Custom field giving no output :-/

‘Author’ is probably among the reserved names that cannot be used for custom fields. (Though in that case changing it to another name would have solved your problem.) Anyway, don’t use any name that is also in use as a tag attribute.

Did you have a look at the tag trace of a page where the tag doesn’t work?

I would have thought it was the other custom_field tag that was giving you trouble; it needs to be in single instead of double quotes.

Offline

#3 2009-05-21 22:44:25

ploinkr
Member
From: Montreal
Registered: 2007-12-06
Posts: 83

Re: Custom field giving no output :-/

Els, thanks for your reply.
I ckecked the tag trace and I’m not sure it shows anything wrong. Here’s a chunk of code from it, with the field Auteur (changed it back to French) appearing near the bottom:

<txp:custom_field name="FirstName" /> <txp:custom_field name="LastName" /> <txp:custom_field name="Exhibition Title" /> <txp:if_custom_field name="Start Date (yy/mm/dd)"> [<txp:if_custom_field name="Start Date (yy/mm/dd)">: true] <txp:custom_field name="Start Date (yy/mm/dd)"/> <txp:custom_field name="End Date (yy/mm/dd)"/> </txp:if_custom_field> <txp:custom_field name="Event Date and Time"/> <txp:if_custom_field name="Vernissage"> [<txp:if_custom_field name="Vernissage">: true] <txp:custom_field name="Vernissage" /> </txp:if_custom_field> <txp:body/> <txp:custom_field name="LastName" /> <txp:custom_field name="Auteur" /> <txp:custom_field name="LastName"/> <txp:custom_field name="LastName"/>

Still scratching my head…

By the way, did you mean the "LastName" custom field should be in single quotes? Tried that and and the content doesn’t appear…
Thanks again!

Offline

#4 2009-05-21 23:20:47

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: Custom field giving no output :-/

ploinkr wrote:

did you mean the "LastName" custom field should be in single quotes?

<txp:article_custom clues="texts" LastName='<txp:custom_field name="LastName"/ >' form="lofi_texts" />

Also, although it doesn’t seem to affect your tag trace, note that Textbook has this to say about custom fields :

Custom names may include letters (uppercase or lowercase), numbers and under_scores, but no spaces or other special characters.

So your field called Start Date (yy/mm/dd) violates that on 4 counts! I know I’ve had some odd results when I’ve used spaces in the past, which is very annoying when you want to use the custom field names to help a client out :-( But there is a good reason for it. Imagine this tag:

<txp:article_custom clues="texts" Start Date (yy/mm/dd)="09/05/21" form="lofi_texts" />

You can immediately see the problem that the article_custom tag is going to face when it tries to read your custom field name as an attribute. In your case I think you can get away with it because LastName is “valid”, but in general it’s not a good idea. You could try renaming your custom fields to remove the special characters just to see if it made any difference? Perhaps an earlier custom field is actually causing one later on in the page to not work? It’s a long shot, but this is a weird problem…


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2009-05-22 02:38:19

ploinkr
Member
From: Montreal
Registered: 2007-12-06
Posts: 83

Re: Custom field giving no output :-/

Stef,
thanks, I just discovered that recently (custom field names were not created by me) and changed them all tonight, but it didn’t help.
After investigating a bit more I’m starting to think the problem might have to do with updating from 4.0.5 to 4.0.8, as it seems to be working for articles created before the update. OR… could it be MLP? The Diagnostics page shows the message Some Textpattern files have been modified: /../../textpattern/lib/txplib_db.php – which I thought was normal, but is it?
Phew…. Thanks again for your help!

B.

Last edited by ploinkr (2009-05-22 02:39:39)

Offline

#6 2009-05-22 05:09:38

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Custom field giving no output :-/

ploinkr

That’s normal for the MLP pack.


Steve

Offline

#7 2009-05-22 12:27:14

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Custom field giving no output :-/

ploinkr wrote:

I just discovered that recently (custom field names were not created by me) and changed them all tonight, but it didn’t help.

Did you also change them in MLP > snippets > specials?

Offline

#8 2009-05-22 13:51:26

ploinkr
Member
From: Montreal
Registered: 2007-12-06
Posts: 83

Re: Custom field giving no output :-/

Steve, thanks for confirming.

Els, I did that, too… Will investigate some more and post my findings here – if any!

Offline

Board footer

Powered by FluxBB