I want to call an EE tag within PHP but am getting an error because PHP doesn’t like the { of the EE tag. I’m simply trying to call an integer from a channel entry then add 15 to it - this is what I have:
height="<?php
$height = {video_file_height} + 15;
echo "$height"; ?>"I have PHP enabled to parse at output (I have tried at input, too).
Any suggestions from PHP experts more than welcome!
Just tried putting the quote marks in. It prevents the code from throwing an error, but it just outputs 15, rather than adding two figures together. My guess is that the quotes mean the PHP treats the EE value as a string rather than an integer and doesn’t add it to the sum. Could this be right? And, if so, is there a workaround?
You can try intval:
height="<?php
$height = intval('{video_file_height}') + 15;
echo "$height"; ?>"Works for me if PHP is parsed on output.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.