Forum
PHP Variables
Hello,
I am trying to put my page attribute outcome into a PHP variable, to use it elsewhere.
$onderwerp = perch_page_attributes(array(
'template' => 'onderwerp.html',
'return-html' => true
));
This code automatically outputs the chosen page attribute, but using:
echo $onderwerp;
I get nothing at all.
This returns only one output of the attribute:
$onderwerp = perch_page_attributes(array(
'template' => 'onderwerp.html',
'return-html' => true
));
echo $onderwerp;
So the attribute is not being saved in the variable, what am I doing wrong?
Thanks, Mike
Hello Mike,
If you want to return the value of the rendered template (and assigning it to a variable), you need to set the second parameter to
true
:Ah ofcourse, was close but not close. Thank you, Hussein.