Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-03-12 17:43:26

chad
Member
Registered: 2006-08-06
Posts: 12

Fix for `undefined function tpt_yield()`

After upgrading from 4.5.7 to 4.6.2, I got this error when trying to load my site:

Fatal error: Call to undefined function tpt_yield() in /mysite/textpattern/publish/taghandlers.php(4344) : eval()'d code on line 2

I was using tpt_yield in one of my forms, inside a <txp:php> block. It seems there’s a new way to call this function now. It took me a little while to figure out, so I’m documenting it here in case anyone else has the problem.

Replace: txp_yield()
With: Txp::get('\Textpattern\Tag\Syntax\Partial')->renderYield()

Last edited by chad (2017-03-12 17:44:16)

Offline

#2 2017-03-12 19:03:34

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,135
Website Mastodon

Re: Fix for `undefined function tpt_yield()`

curious. what does the code actually do?


…. texted postive

Offline

#3 2017-03-12 19:43:56

chad
Member
Registered: 2006-08-06
Posts: 12

Re: Fix for `undefined function tpt_yield()`

It’s the PHP equivalent of the <txp:yield /> tag.

I’m using it like this:

<txp:output_form form="my_form">my-file.jpg</txp:output_form>

my_form:

<txp:php>
$imagefile = 'images/'.Txp::get('\Textpattern\Tag\Syntax\Partial')->renderYield();
if (file_exists($imagefile)) { ... }
</txp:php>

Offline

#4 2017-03-12 22:40:28

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,135
Website Mastodon

Re: Fix for `undefined function tpt_yield()`

thanks. gave me an idea and i actually can use this


…. texted postive

Offline

#5 2017-03-13 06:55:15

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,238
Website GitHub Mastodon Twitter

Re: Fix for `undefined function tpt_yield()`

??? tpt_yield() ??? Are you sure you did not mistype something?


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 2017-03-13 08:39:57

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,987
Website GitHub

Re: Fix for `undefined function tpt_yield()`

colak wrote #304650:

??? tpt_yield() ??? Are you sure you did not mistype something?

I think there was a reason for it having a deliberately alternative name. Jukka explained it here.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB