Hi there,
Just wondering if someone could help me with something that I thought I was doing right but I’m obviously not as it just isn’t working ![]()
What I want to do is this :
pi.test.php
{exp:test}
{my_variables}
{/exp:test}
Please for now don’t shout at me for the bad naming convention of the plugin, this really is just a test at the moment ![]()
Now I have this code in the pi.test.php plugin :
<?php
/*
=========================================================================
Copyright (c) 2008 Mark Bowen Design
=========================================================================
File: pi.test.php V1.0.0
-------------------------------------------------------------------------
Purpose: Test
=========================================================================
CHANGE LOG :
6th July 2008
- Version 1.0.0
- Creation of initial plugin
=========================================================================
*/
$plugin_info = array(
'pi_name' => 'Test',
'pi_version' => '1.0.0',
'pi_author' => 'Mark Bowen',
'pi_author_url' => 'http://www.markbowendesign.com/',
'pi_description' => 'Test',
'pi_usage' => Test::usage()
);
class Test {
var $return_data = '';
function test()
{
global $TMPL, $DB, $SESS, $LOC, $FNS;
$tagdata = $TMPL->tagdata;
// echo $tagdata;
$numbers = "12";
$tagdata = $TMPL->swap_var_single($my_variables, $numbers, $tagdata);
$this->return_data = $tagdata;
}
// ----------------------------------------
// Plugin Usage
// ----------------------------------------
function usage()
{
ob_start();
?>
EXAMPLE CODE
---------------------------------
{exp:test}
{my_variables}
{/exp:test}
<?php
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
// END
}
?>
Basically as you can see in the plugin I am setting $numbers=“12”. I then wanted to be able to spit that out in place of the {my_variables} variable that exists in between the tag pair.
I have read and re-read over the documentation for this but truly it is just going over my head at the moment and I thought that I was doing this correctly. If I do this though :
$tagdata = "12";
$this->return_data = $tagdata;
it does return what I am after. How though do I make it do that with the variable?
Any help would be greatly appreciated. I know I must be missing something obvious here but just can’t see the forest for the trees at the moment! ![]()
Best wishes,
Mark
