Jump to content

Cleaning up coding in parser script


acctman

Recommended Posts

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

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);
                }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.