Error in invoking a plugin - PHP4 vs PHP5

From: Date: Wed, 25 Oct 2006 22:35:49 +0000
Subject: Error in invoking a plugin - PHP4 vs PHP5
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-13532@lists.php.net to get a copy of this message
Hello, I have a plugin "dispCheckbox" which works just fine when run under PHP5. When I take the exact same codebase and run it under a PHP4 engine, I get the Smarty function not found error: Fatal error: Smarty error: [in Navigation/Views/Default/Manager/NavItemForm.tpl line 37]: syntax error: unrecognized tag 'dispCheckbox' (Smarty_Compiler.class.php, line 580) in /usr/local/soft/httpd_php4/htdocs/chameleon/Core/Includes/Smarty-2.6.13/libs/Smarty.class.php on line 1095 Attached is my PHP source. I am NOT doing anything PHP5 specific. This plugin calls one other plugin ("dispLabel") which also is composed of PHP4 friendly code. Any one have any ideas? Thanks -William

<?php function smarty_function_dispCheckBox($params, &$smarty) { //Bring in general plugin require_once $smarty->_get_plugin_filepath('function', 'dispLabel'); $label = isset($params['label']) ? stripslashes($params['label']) : ''; $note = isset($params['note']) ? stripslashes($params['note']) : ''; $itemValue = isset($params['itemValue']) ? stripslashes($params['itemValue']) : 0; $checkValue = isset($params['checkValue']) ? stripslashes($params['checkValue']) : 0; $readOnly = isset($params['readOnly']) ? $params['readOnly'] : false; $disabled = isset($params['disabled']) ? $params['disabled'] : ''; //name if(!isset($params['name'])) { die("Error: [dispCheckBox]: missing 'name' parameter"); } else { $name = stripslashes($params['name']); } echo "<div class=\"jbFormRow\">\n"; //dispLabel $labelParams = array( 'label' => $label, 'forField' => $name, 'note' => $note ); smarty_function_dispLabel($labelParams, $smarty); echo "<span class=\"jbFormItemInput\">\n"; if(!$readOnly) { echo "<input type = \"checkbox\" id = \"$name\" name = \"$name\" value = \"$checkValue\" "; if($checkValue == $itemValue) { echo " checked "; } echo " />"; } else { if($value == 1) { echo 'Yes'; } if($value == 0) { echo 'No'; } echo "<input type=\"hidden\" id=\"$name\" name=\"$name\" value=\"$checkValue\" />"; } echo "</span></div>"; } ?>
« previous php.smarty.general (#13532) next »