Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-07-03 18:37:07

dmarino
Member
From: Southern New Hampshire
Registered: 2007-06-15
Posts: 18
Website

Trying to access custom variable data via php

Like the subject says… I’m trying to access data in my custom field via raw php (or using the <txp:php> tag). I need to set the data from the custom field as a variable so that I can manipulate it.

Thanks

Offline

#2 2008-07-03 19:00:08

dmarino
Member
From: Southern New Hampshire
Registered: 2007-06-15
Posts: 18
Website

Re: Trying to access custom variable data via php

http://www.focusontheclouds.com/home/articles/72/accessing-global-variables-in-textpattern

guess I didn’t read the comments close enough the first time – see comment #3:

$GLOBALS[‘thisarticle’][‘Name of Custom Field’]

Offline

#3 2008-07-03 20:48:58

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

Re: Trying to access custom variable data via php

Or you can always use the tags – cause they are just functions:

$my_custom_field = custom_field(array(
	'name' => 'my-custom-field',
));

Last edited by Gocom (2008-07-03 20:49:32)

Offline

Board footer

Powered by FluxBB