26/01/2006, 20h42
|
#6
|
|
|
Re: [SMARTY] Basic question
http://www.phpinsider.com/smarty-for...pic.php?t=4936
Howler wrote:
>The line:
>
>ini_set('magic_quotes_gpc',0);
>
>Doesn't seem to turn off magic_quotes, perhaps this is something that
>needs to be set in the php.ini. I don't have access to the global
>php.ini, but my understanding is that the script will look in the
>current directory for a php.ini, then wwwroot, and then the global
>position. Is this correct? My hosting service provider put a copy of
>php.ini in my directory for me, and I turned off magic_quotes in it, but
>still no joy.
>
>Thanks,
>John
>
>
>Monte Ohrt wrote:
>
>
>
>>I think so, see the PHP docs.
>>
>>Howler wrote:
>>
>>
>>
>>>Monte,
>>>
>>>Thanks, is this something that I can turn off via ini_set()?
>>>
>>>
>>>Monte Ohrt wrote:
>>>
>>>
>>>
>>>
>>>
>>>>A hunch, turn off PHP magic quotes?
>>>>
>>>>Howler wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Hello Everyone,
>>>>>
>>>>>I apologize in advance as I am sure that this question has been
>>>>>answered
>>>>>before. I have searched through mail lists and news groups and have
>>>>>not
>>>>>found a satifactory answer.
>>>>>
>>>>>I am still pretty new to PHP/Smarty so please be patient.
>>>>>
>>>>>I have installed Smarty to my Linux hosting server. I installed it
>>>>>outside of the www directory per the recommendations.
>>>>>/www
>>>>> |_______>myappstuff
>>>>> |_______>lib
>>>>> .
>>>>> .
>>>>> .
>>>>>/Smarty
>>>>> |_____> internals
>>>>> |_____>plugins
>>>>> |_____>myappstuff
>>>>> | |________>cache
>>>>> | |________>configs
>>>>> | |________>templates
>>>>> | |________>templates_c
>>>>> |
>>>>> |
>>>>> |________________>Config_file.class.php
>>>>> |________________>debug.tpl
>>>>> |________________>Smarty.class.php
>>>>> |________________>Smarty_Compiler.class.php
>>>>>
>>>>>
>>>>>I set the path using the ini_set and I can find the Smarty.class.php
>>>>>without issue, what seems to be the problem is that when my PHP code
>>>>>performs the $smSmarty->display('index.tpl'); I get the following
>>>>>error:
>>>>>
>>>>>=================
>>>>>
>>>>>*Warning*: Unexpected character in input: '\' (ASCII=92) state=1 in
>>>>>*/home/vomramha/smarty/Smarty_Compiler.class.php* on line *180*
>>>>>
>>>>>*Parse error*: parse error, unexpected ')', expecting ',' or ';' in
>>>>>*/home/myhomedir/smarty/Smarty_Compiler.class.php* on line *180*
>>>>>
>>>>>==================
>>>>>
>>>>>
>>>>>I believe that I have the permissions set correctly but I am not sure,
>>>>>it could be something that I missed in my code.
>>>>>
>>>>>==================
>>>>>
>>>>>
>>>>>index.php
>>>>>
>>>>><?php
>>>>>
>>>>>ini_set
>>>>>('include_path',".:/usr/lib/php:/usr/local/lib/php:/home/myhomedir/smarty");
>>>>>
>>>>>
>>>>>require_once ('Smarty.class.php');
>>>>>require_once ('lib/my_dbconnect.php');
>>>>>
>>>>>
>>>>>$smSmarty = new Smarty;
>>>>>
>>>>>$smSmarty->compile_check = true;
>>>>>$smSmarty->debugging = true;
>>>>>
>>>>>$smSmarty->template_dir = '/home/myhomedir/www/myappstuff/templates/';
>>>>>$smSmarty->compile_dir =
>>>>>'/home/myhomedir/www/myappstuff/templates_c/';
>>>>>$smSmarty->cache_dir = '/home/myhomedir/www/myappstuff/cache/';
>>>>>$smSmarty->config_dir = '/home/myhomedir/www/myappstuff/configs/';
>>>>>$smSmarty->force_compile = true;
>>>>>
>>>>>$smSmarty->assign('Name', 'Joe');
>>>>>
>>>>>if ($smSmarty->template_exists('index.tpl'))
>>>>>{
>>>>> if(!$smSmarty->is_cached('index.tpl'))
>>>>> {
>>>>> $smSmarty->display('index.tpl');
>>>>> }
>>>>>}
>>>>>else
>>>>>{
>>>>> $smSmarty->display('debug.tpl');
>>>>> phpinfo();
>>>>>}
>>>>>?>
>>>>>
>>>>>index.tpl
>>>>>
>>>>>
>>>>><html>
>>>>><head>
>>>>><title>My Smarty test App</title>
>>>>></head>
>>>>>
>>>>><body>
>>>>>This is a test: {$Name}
>>>>></body>
>>>>></html>
>>>>>
>>>>>
>>>>>==================
>>>>>
>>>>>
>>>>>
>>>>>index.php does find the template and executes the correct code,
>>>>>however
>>>>>when the line:
>>>>>
>>>>> $smSmarty->display('index.tpl');
>>>>>
>>>>>is executed I get the error.
>>>>>
>>>>>
>>>>>Any assistance would be greatly appreciated.
>>>>>
>>>>>Thanks in advance!
>>>>>John
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>>>
>
>
>
>
>
>
>
>
>!DSPAM:43d933b5178798168050397!
>
>
>
>
|
|
|
|