Re: removing slashes from template file

From: Date: Fri, 13 Apr 2001 04:08:39 +0000
Subject: Re: removing slashes from template file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48403@lists.php.net to get a copy of this message
Thanks to Chris Adams this problem is now solved. magic_quotes_runtime was set to ON at my hosting service. I used set_magic_quotes_runtime(0) in the top of my script and the site works like a champ now. If you want magic quotes to be ON then just use 1 instead. http://www.php.net/manual/en/function.set-magic-quotes-runtime.php Thanks Chris!! //frank On Thu, 12 Apr 2001, Franklin Hays wrote: |Date: Thu, 12 Apr 2001 20:15:32 -0700 (PDT) |From: Franklin Hays <frank@kyk.als.orst.edu> |To: php-general@lists.php.net |Subject: [PHP] removing slashes from template file | |Asked this earlier but didn't get a response, may have been lost in the |volume or I need to clarify things. If the latter please let me |know. Some help is greatly appreciated as I am stuck. | |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 | | |-- |PHP General Mailing List (http://www.php.net/) |To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net |For additional commands, e-mail: php-general-help@lists.php.net |To contact the list administrators, e-mail: php-list-admin@lists.php.net | | | | |-- |PHP General Mailing List (http://www.php.net/) |To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net |For additional commands, e-mail: php-general-help@lists.php.net |To contact the list administrators, e-mail: php-list-admin@lists.php.net | |

« previous php.general (#48403) next »