slashes added to template files

From: Date: Thu, 12 Apr 2001 05:37:35 +0000
Subject: slashes added to template files
Groups: php.general 
Request: Send a blank email to php-general+get-48244@lists.php.net to get a copy of this message
Apologies in advance if this has been discussed before or is a simple fubar on my part. I can only search through the archives for so long... :-) Experiencing a frustrating problem on this end with slashes being added to my template files. Here are the details: Using PHP on a webhost that compiled php as a cgi in my www/cgi-bin directory. I have all HTML files in templates/filename.tpl and all PHP files in includes/filename.inc, this includes the template.inc file from PHPLib. I have a file called 'script' with the following in it: <?php require('includes/Directory.inc'); include('includes/Header.inc'); // Now parse a second template: $t->set_file("MainHandle","MainGadget.tpl"); // wholePage.ihtml has "{MyOutput}" in it $vari= $t->parse("MyFinalOutput","MainHandle"); // All {MyOutput}'s get replaced $t->p("MyFinalOutput"); // output the value of MyFinalOutput /*eval( "?>".$vari );*/ include('includes/Footer.inc'); ?> include/Directory.inc has the following in it: <?php include('includes/Template.inc'); $url_array=explode("/",$REQUEST_URI); $url_cat=$url_array[3]; $url_grp=$url_array[4]; $url_misc=$url_array[5]; $t = new Template("/www/hostname/ocean/templates/"); $title = "name"; if($url_misc == 'misc') { $Handle='MiscHandle'; $Template='MiscGadget.tpl'; } elseif ($url_grp == 'tanks') { $Handle='TankHandle'; $Template='TankGadget.tpl'; } elseif ($url_cat == 'psupply') { // These three lines are the same as the first example: $Handle='PowerHandle'; $Template='PowerGadget.tpl'; } elseif ($url_cat == 'purpose') { $Handle='PurposeHandle'; $Template='PurposeGadget.tpl'; } else { $Handle='IntroHandle'; $Template='IntroGadget.tpl'; } $t->set_file("$Handle","$Template"); $t->set_var("name",$title); $t->parse("MyOutput","$Handle"); ?> Now, this setup work without a hitch on my personal development server where PHP is loaded as a module in Apache. The file called via the 'script' above is loaded into the MainGadget.tpl template and displayed without a problem. Everything, including javascript, works great. Now, I moved this code to the providers server, where the only difference I can tell is php works as a cgi , and I get output from the HTML files with slashes added to the HTML, such as: <a href=\'about.php\' onMouseOut=\'MM_swapImgRestore()\" onMouseOver=\"MM_swapImage(\'about\',\'\',\'graphics/toolsbar3_01.gif\',1)\"><img name=\"about\" border=\"0\" src=\"graphics/toolsbar_01.gif\" width=\"105\" height=\"35\"></a> <a href=\'contact.php\' onMouseOut=\'MM_swapImgRestore()\' onMouseOver=\'MM_swapImage(\'contact\',\'\',\'graphics/toolsbar3_02.gif\',1)\"><img name=\"contact\" border=\"0\" src=\"graphics/toolsbar_02.gif\" width=\"96\" height=\"35\"></a> Everything else is output just fine. The only HTML with this in it is the {MyOutput} files from templates directory (.tpl files). I am not very familiar with PHPLib but imagine there is some other not so subtle item I am missing since things work great on my linux/apache/php4 server. Any ideas? I have tried using stripslashes() in the 'script' above but get errors. Is there something unique to the php cgi I am missing? Something else? Any all help is greaty appreciated!! Thanks, //frank

« previous php.general (#48244) next »