acctman Posted August 21, 2008 Share Posted August 21, 2008 Hi anytime I add <?php to a .tpl file on my site I receive a parse error Parse error: syntax error, unexpected T_STRING in /home/site/public_html/kernel/parser.php(318) : eval()'d code on line 2 after looking in the parser.php file, I figured out what the problem is. It seems to be looking for <? only. I know I can do a || for or but it looks like its isolating the two first characters with the substr. I can I make it look for <?php as well. I'm in the process of cleaning up all the <? tags but just in cause a miss a few i want to have both. elseif (substr($s,0,2) == '<?') { if ($nx != '') $this->templ[] = $nx; $nx = $s; } else $nx .= ($nx != '' ? "\n" : '').$s; if (substr($nx,-2) == '?>') { $this->templ[] = $nx; $nx = ''; } //ordinary output if (substr($value,0,5) != '<!--[' && substr($value,0,2) != '<?') { $this->act[$key] = 'do_print'; } //eval elseif (substr($value,0,2) == '<?') { $this->act[$key] = 'do_eval'; } Link to comment https://forums.phpfreaks.com/topic/120752-cleaning-up-coding-in-parser-script/ Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 use the || or operator: elseif (substr($s,0,2) == '<?' || substr($s,0,5) == '<?php') { Link to comment https://forums.phpfreaks.com/topic/120752-cleaning-up-coding-in-parser-script/#findComment-622360 Share on other sites More sharing options...
acctman Posted August 21, 2008 Author Share Posted August 21, 2008 use the || or operator: elseif (substr($s,0,2) == '<?' || substr($s,0,5) == '<?php') { thats what i was trying, i see where I messed up at I had a parentheses in front of the substr... thanks. Link to comment https://forums.phpfreaks.com/topic/120752-cleaning-up-coding-in-parser-script/#findComment-622378 Share on other sites More sharing options...
acctman Posted August 21, 2008 Author Share Posted August 21, 2008 hmm that didn't completely fix the problem... further in the coding it calls this piecen of coding, which is looking for just two characters <? # Eval function do_eval() { global $names, $en; extract($names); $ev = substr($this->s,2,-2); eval($ev); } Link to comment https://forums.phpfreaks.com/topic/120752-cleaning-up-coding-in-parser-script/#findComment-622394 Share on other sites More sharing options...
acctman Posted August 22, 2008 Author Share Posted August 22, 2008 any idea how to fix the going above? Link to comment https://forums.phpfreaks.com/topic/120752-cleaning-up-coding-in-parser-script/#findComment-622598 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.