Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

a question,please help me...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
phpbird
Smarty Rookie


Joined: 09 Oct 2003
Posts: 5

PostPosted: Thu Oct 09, 2003 7:50 am    Post subject: a question,please help me... Reply with quote

i want to use smarty,and i want to use this to all of my web site ,no one single module.so i want to define one templates dir and others dirs.

i add code below at the top of
Smarty.class.php

$base_dir='/home/smartctl/';
if (!file_exists($base_dir."templates"))
mkdir($base_dir."templates",0777);
if (!file_exists($base_dir."templates_c"))
mkdir($base_dir."templates_c",0777);
if (!file_exists($base_dir."configs"))
mkdir($base_dir."configs",0777);

and modify

var $template_dir = '/home/savedata/templates';
var $compile_dir = '/home/savedata/templates_c';
var $config_dir = '/home/savedata/configs';

like this
var $template_dir = $base_dir.'templates';
var $compile_dir = $base_dir.'templates_c';
var $config_dir = $base_dir.'configs';

but ,when the php of website upgrade,the script doesn't work!

the message is


Parse error: parse error in /home/data/fu/smarty/libs/Smarty.class.php on line 92


help me .....
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Oct 09, 2003 8:23 am    Post subject: Reply with quote

read http://smarty.php.net/manual/en/installing.smarty.basic.php

you SHOULD NOT EDIT any of the smarty-files.

you can configure $smarty->template_dir et. al. after you got your instance of $smarty with "new".

(btw: only constant expressions are allowed after "var")

[edit: grmpf, pasted wrong link. corrected]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
phpbird
Smarty Rookie


Joined: 09 Oct 2003
Posts: 5

PostPosted: Thu Oct 09, 2003 8:30 am    Post subject: Reply with quote

why can't modify the smarty-files?

i modify the file just want to use it more easy... Rolling Eyes

now how can i modify the default dirs like what i want?
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Oct 09, 2003 8:38 am    Post subject: Reply with quote

phpbird wrote:
why can't modify the smarty-files?

of course, you can, but you shouldn't. and if you do so without really knowing what you do, don't ask for help here.

Quote:
now how can i modify the default dirs like what i want?


again: read http://smarty.php.net/manual/en/installing.smarty.basic.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website
phpbird
Smarty Rookie


Joined: 09 Oct 2003
Posts: 5

PostPosted: Thu Oct 09, 2003 8:57 am    Post subject: Reply with quote

i success the test...
the reason is ...

<?php
/* None of these will work in PHP 4. */
class Cart
{
var $todays_date = date("Y-m-d");
var $name = $firstname;
var $owner = 'Fred ' . 'Jones';
var $items = array("VCR", "TV");
}

/* This is how it should be done. */
class Cart
{
var $todays_date;
var $name;
var $owner;
var $items;

function Cart()
{
$this->todays_date = date("Y-m-d");
$this->name = $GLOBALS['firstname'];
/* etc. . . */
}
}
?>



thank u~~ Laughing
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Oct 09, 2003 11:55 pm    Post subject: Reply with quote

phpbird wrote:
why can't modify the smarty-files?

i modify the file just want to use it more easy... Rolling Eyes

now how can i modify the default dirs like what i want?


Perhaps the next page of the manual is even better for you since it has an example of sub-classing Smarty so that you can make customizations without touching the base Smarty files.

http://smarty.php.net/manual/en/installing.smarty.extended.php
Back to top
View user's profile Send private message
phpbird
Smarty Rookie


Joined: 09 Oct 2003
Posts: 5

PostPosted: Fri Oct 10, 2003 1:16 am    Post subject: Reply with quote

boots wrote:
phpbird wrote:
why can't modify the smarty-files?

i modify the file just want to use it more easy... Rolling Eyes

now how can i modify the default dirs like what i want?


Perhaps the next page of the manual is even better for you since it has an example of sub-classing Smarty so that you can make customizations without touching the base Smarty files.

http://smarty.php.net/manual/en/installing.smarty.extended.php



ok.it's a good idea!thanks a lot. Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP