Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-08-05 22:49:23

dquirk
Member
Registered: 2005-10-22
Posts: 12

parse function no longer working after upgrade from 4.0.5 to 4.0.8

I recently upgraded from 4.0.5 to 4.0.8, and I have some PHP code in an article form that’s no longer working, apparently because the parse() function isn’t returning anything.

The code is enclosed between <txp:php> and </txp:php> tags, and what it’s supposed to do is take the data stored in a php custom field and store it in a php variable. The way this worked before the upgrade was that the php variable was assigned the result of a txp:custom_field name=“field_name” tag that was in turn passed to the Texpattern parse() function. This worked until the upgrade. I’ve verified that the txp:custom_field name tag is returning a result outside of php code, so it seems that the parse function is not returning anything when passed the tag.

Thanks for any tips or pointers.

Doug

Offline

#2 2009-08-05 23:14:49

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: parse function no longer working after upgrade from 4.0.5 to 4.0.8

Check your diagnostics tab. Make sure all files were upgraded.

Offline

#3 2009-08-05 23:37:00

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

Re: parse function no longer working after upgrade from 4.0.5 to 4.0.8

Could it be caused by this change in 4.0.7?

Offline

#4 2009-08-05 23:59:10

dquirk
Member
Registered: 2005-10-22
Posts: 12

Re: parse function no longer working after upgrade from 4.0.5 to 4.0.8

Looks like all the files were upgraded, and the custom field tag is working if I use it in (X)HTML—the problems crop up when I use it in PHP and try to pass the result to a variable using parse().

Does anyone know what file the parse function is in?

Offline

#5 2009-08-06 00:02:24

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: parse function no longer working after upgrade from 4.0.5 to 4.0.8

dquirk wrote:

Does anyone know what file the parse function is in?

publish.php


Code is topiary

Offline

#6 2009-08-07 19:26:20

dquirk
Member
Registered: 2005-10-22
Posts: 12

Re: parse function no longer working after upgrade from 4.0.5 to 4.0.8

After much trial and error I think I figured this out—

It appears that the parse() function changed somewhere between 4.0.5 and 4.0.8 such that the closing forward slash of a Textpattern tag needs to be escaped with a backslash when passed to the parse() function with 4.0.5, and does not need to be escaped with 4.0.8 (and things go haywire if you do escape it).

Doug

Offline

#7 2009-08-07 19:33:00

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

Re: parse function no longer working after upgrade from 4.0.5 to 4.0.8

dquirk wrote:

It appears that the parse() function changed somewhere between 4.0.5 and 4.0.8

Probably in 4.0.7 with the introduction of tags in tags and stuff.

Glad you got it figured out.


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

#8 2009-08-07 20:05:39

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: parse function no longer working after upgrade from 4.0.5 to 4.0.8

Strange, if you supply invalid TXP tags to the new parser it returns the unparsed tags, but it will not return nothing.

Offline

Board footer

Powered by FluxBB