Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-11 22:04:11

novatron6
Member
Registered: 2006-10-15
Posts: 11

Inserting custom field into php...

Hey All,

Looking for a way to insert custom field data into a php script (I don’t think the forum lets you search for a three letter word so I am having difficutly…)

Here is what I am wanting to do:

<txp:php>
$numberOf = ‘<txp:custom_field name=“support_level” />’;
$totalNumberOf = ‘<txp:custom_field name=“support_goal” />’;

echo round(($numberOf / $totalNumberOf) * 100);
</txp:php>

Can anyone point me in the right direction? Help is appreciated, thanks!

doug

Offline

#2 2007-12-11 22:15:29

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Inserting custom field into php...

Try:

<txp:php>
	$numberOf = custom_field(array(name => 'support_level'));
	$totalNumberOf = custom_field(array(name => 'support_goal'));
	echo round(($numberOf / $totalNumberOf) * 100);
</txp:php>

Cheers!

Offline

#3 2007-12-14 21:39:11

novatron6
Member
Registered: 2006-10-15
Posts: 11

Re: Inserting custom field into php...

This works great! Thanks for the help!

doug

Offline

Board footer

Powered by FluxBB