Let me start off by saying I’m a designer/front-end developer. I just need to a little php help.
I’m writing a conditional where I need to obtain the character count of a field. I’ve enabled PHP for the template and I have the following code but I’m just guessing so it’s not working, do I need to use eval?
Any advice would be appreciated.
{if <?php requirements($end_char)?> >= 10}[Mod Edit: Moved to the Development and Programming forum]
Make sure PHP mode is set to Output on the template settings.
If you’re using PHP on Output you may need to keep the conditional in PHP as well (untested so I’m unsure).
<?php
if (strlen("{field_name}") >= 10)
{
?>
// something here if true
<?php
}
?>Or the alternate control structure:
<?php if (strlen("{field_name}") >= 10) : ?>
// something here if true
<?php endif; ?>Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.