PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Parse error: syntax error, unexpected T_GLOBAL (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Parse error: syntax error, unexpected T_GLOBAL


#982
kksou (Admin)
Admin
Posts: 1680
graph
User Online Now Click here to see the profile of this user
Re:Parse error: syntax error, unexpected T_GLOBAL 4 Years, 8 Months ago Karma: 27  
Hi Salvatore,

Yes, it's those double-byte or unicode characters that cause the error.

Could you please edit the file DirectPHP again and add the following to line 81:

Code:
$str = str_replace(chr(hexdec('C2')).chr(hexdec('A0')), '', $str);
so that it looks like:
Code:
function fix_str2($str) {
	$str = str_replace('<br>', "\n", $str);
	$str = str_replace('<br />', "\n", $str);
	$str = str_replace('<p>', "\n", $str);
	$str = str_replace('</p>', "\n", $str);
	$str = str_replace('&#39;', "'", $str);
	$str = str_replace('&quot;', '"', $str);
	$str = str_replace('&lt;', '<', $str);
	$str = str_replace('&gt;', '>', $str);
	$str = str_replace('&amp;', '&', $str);
	$str = str_replace('&nbsp;', ' ', $str);
	$str = str_replace('&#160;', "\t", $str);
	$str = str_replace(chr(hexdec('C2')).chr(hexdec('A0')), '', $str);
	return $str;
}
    Let me know if it works...
      Regards,
        /kksou
         
         
        Last Edit: 2008/10/11 23:40 By kksou.
          The administrator has disabled public write access.

        #983
        kksou (Admin)
        Admin
        Posts: 1680
        graph
        User Online Now Click here to see the profile of this user
        Re:Parse error: syntax error, unexpected T_GLOBAL 4 Years, 8 Months ago Karma: 27  
        Hi Salvatore,

        I've just added the code above to DirectPHP. You can download the latest copy from:

        http://www.kksou.com/php-gtk2/Joomla/DirectPHP-plugin.php

        I think the new version should be able to remove those double-byte or unicode characters, which I believe is added to your content by your editor for some unknown reason. I'm using Joomla English version. I think you are using a non-English version. Hence the additional double-byte or unicode characters. Try pumping this into a PHP eval() statement. It's these characters that cause the error.

        Regards,
        /kksou
         
          The administrator has disabled public write access.

        #986
        salrandazzo (User)
        Fresh Boarder
        Posts: 6
        graphgraph
        User Offline Click here to see the profile of this user
        Re:Parse error: syntax error, unexpected T_GLOBAL 4 Years, 8 Months ago Karma: -1  
        Hi Kksou, very good job indeed!
        Now it works perfectly. I'll try to use it to read a database with result of a survay made, on a different website, using Facile Forms on joomla 1.0. Did you already update also jommla 1.0 version? Thank you again for your fast intervention, ON SUNDAY! :-D
        Have a nice week!.
        Salvo
         
          The administrator has disabled public write access.
        #994
        kksou (Admin)
        Admin
        Posts: 1680
        graph
        User Online Now Click here to see the profile of this user
        Re:Parse error: syntax error, unexpected T_GLOBAL 4 Years, 8 Months ago Karma: 27  
        Hi Salvatore,

        Glad it works!

        Yes, have updated both the 1.0 and 1.5 version.

        Regards,
        /kksou
         
          The administrator has disabled public write access.
        #2702
        scottrogers (User)
        Fresh Boarder
        Posts: 1
        graphgraph
        User Offline Click here to see the profile of this user
        Re:Parse error: syntax error, unexpected T_GLOBAL 3 Years, 8 Months ago Karma: 0  
        Hey Thank You!!! Direct PHP is AWESOME!!!

        I was having a simular problem and this post help me figure it out. I was getting the error

        Parse error: syntax error, unexpected '<' in PATH...\DirectPHP.php(56) : eval()'d code on line 1

        I echo out the code mentioned above "echo "phpcode2 = ".htmlentities($phpcode2)."<br>";"

        And this is what I was getting
        phpcode2 = <BR>session_start(); <BR>$session =& JFactory::getSession(); $fname = $session->get('fname',$_GET["fname"]); $session->set('fname', $fname); $session =& JFactory::getSession(); $lname = $session->get('lname',$_GET["lname"]); $session->set('lname', $lname);


        I remember learning that session_start(); should be called before anything else so I took out the line brakes <BR> and that fixed the problem.

        So this was my code in the WISSYWIG
        <?php
        session_start();
        $session =& JFactory::getSession();
        $fname = $session->get('fname',$_GET["fname"]);
        $session->set('fname', $fname);
        $session =& JFactory::getSession();
        $lname = $session->get('lname',$_GET["lname"]);
        $session->set('lname', $lname);
        ?>

        I change it to...
        <?php session_start(); $session =& JFactory::getSession(); $fname = $session->get('fname',$_GET["fname"]); $session->set('fname', $fname); $session =& JFactory::getSession(); $lname = $session->get('lname',$_GET["lname"]); $session->set('lname', $lname);?>

        Probelm Fixed.
         
          The administrator has disabled public write access.



        Go to top Post Reply
        Powered by FireBoardget the latest posts directly to your desktop

        Blog - Forum - Privacy Policy - Contact Us
        Links - Classes - Social Business - BPM - Web - General
        Copyright © 2006-2013. kksou.com. All Rights Reserved