Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Parsing php in section pages
<txp:php>
...
global $dtstart;
global $dtend;
$dtstart = strftime('%Y%m%dT',$thisarticle['expires']) . $starthours . 'Z';
$dtend= strftime('%Y%m%dT',$thisarticle['expires']) . $endhours. 'Z';
</txp:php>
and
<div class="vevent span-3 last"> <a class="url" href="<txp:permlink />"></a> <abbr class="dtstart" title="<txp:php>echo $dtstart;</txp:php>">August 01, 2010 - 21:00</abbr> <abbr class="dtend" title="<txp:php>echo $dtend;</txp:php>">23:00</abbr>
result:
<txp:php>
Tag error: <txp:php> -> Notice: Undefined variable: dtstart on line 1
</txp:php>
<txp:php>
Tag error: <txp:php> -> Notice: Undefined variable: dtend on line 1
</txp:php>
Where am I messing up this time? sigh
Thanks in advance.
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: Parsing php in section pages
any better when you put <txp:php>global $dtstart; echo $dtstart;</txp:php>
?
TXP Builders – finely-crafted code, design and txp
Offline
Re: Parsing php in section pages
What about this:
global $variable;
$variable['dtstart'] = strftime('%Y%m%dT',$thisarticle['expires']) . $starthours . 'Z';
Last edited by Timid&friendly (2010-07-02 06:52:04)
I think, therefore I AM, … … er … I think :-?
Offline
Re: Parsing php in section pages
JanDW wrote:
Where am I messing up this time? sigh
Thanks in advance.
You need to access the global from the global scope. The variable is not accessible inside the function. For example:
<txp:php>
global $dtstart; /* Back in the biz */
echo $dtstart;
</txp:php>
Or using the $GLOBALS superglobal array which contains all the variables defined in the global scope:
<txp:php>
echo $GLOBALS['dtstart'];
</txp:php>
Offline
Re: Parsing php in section pages
ah, thanks for making me understand, guys.
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline