Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

problem writing '/index.tpl.

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
twopeak
Smarty Rookie


Joined: 09 Jun 2003
Posts: 12

PostPosted: Mon Jun 09, 2003 8:48 pm    Post subject: problem writing '/index.tpl. Reply with quote

I used to have the same problem as many people: writing to a dir would cause an error...
I solved it with the solutions from this forum, but now I'm running into these errors:

Code:
Warning: Smarty error: problem writing '/index.tpl.' in /home/.sites/65/site131/web/php/smarty/smarty.class.php on line 999

Warning: unable to create file /index.tpl because Permission denied in /home/.sites/65/site131/web/php/smarty/smarty.class.php on line 1518

Warning: Failed opening '/index.tpl' for inclusion (include_path='') in /home/.sites/65/site131/web/php/smarty/smarty.class.php on line 1112

Warning: Smarty error: problem writing '/file%3A^home^.sites^65^site131^web^php^smarty^debug.tpl.' in /home/.sites/65/site131/web/php/smarty/ smarty.class.php on line 999

Warning: unable to create file /file%3A^home^.sites^65^site131^web^php^smarty^debug.tpl because Permission denied in /home/.sites/65/site131/web/php/ smarty/smarty.class.php on line 1518

Warning: Failed opening '/file%3A^home^.sites^65^site131^web^php^smarty^debug.tpl' for inclusion (include_path='') in /home/.sites/65/site131/web/php/ smarty/smarty.class.php on line 1212


does it matter I'm using php 4.0.6?

--edit--
oops, damn it... I didn't ment to put this post in bugs, I just pressed the 'new topic' from one of the search results...
sorry! (maybe a mod could put it where it belongs?)
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Tue Jun 10, 2003 12:16 am    Post subject: Reply with quote

it seems, that smarty cannot find your templates_c-directory. it's safest to you use a full-path for "$smarty->compile_dir" , otherwise you have to configure it relative to what getcwd() returns, which is in almost always the directory of the php-script you call and not relative to what SMARTY_DIR is set to.

php-4.0.6 is no problem. it's the minimum required version, which means it's enough Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
twopeak
Smarty Rookie


Joined: 09 Jun 2003
Posts: 12

PostPosted: Wed Jun 11, 2003 1:45 pm    Post subject: Reply with quote

ummmmmmmm
okay...

I'm sorry, I didn't really understand what you wrote, I'm no superadvanced user, I've been told smarty is the best way to use templates and I'm trying to install it now...

I have read the beginning of the manual and a quickstart guide, but I have no idea what you mean by templates_c-directory
and what is the full path to the smarty->compile_dir?
is it the path to the directory that contains the smarty files?


thanx for the help!
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Wed Jun 11, 2003 2:13 pm    Post subject: Reply with quote

twopeak wrote:
ummmmmmmm
okay...

I'm sorry, I didn't really understand what you wrote, I'm no superadvanced user, I've been told smarty is the best way to use templates and I'm trying to install it now...


okay, sorry.

Quote:

I have read the beginning of the manual and a quickstart guide, but I have no idea what you mean by templates_c-directory
and what is the full path to the smarty->compile_dir?
is it the path to the directory that contains the smarty files?


"templates_c" is the directory where smarty stores the templates after compilation. smarty reads your .tpl-files from your templates-dir and converts them to .php-files which are stored in templates_c. you can configure smarty to tell it where you templates-directory and your templates_c-directory is located:

(you have something like "$smarty = new Smarty;" in your index.php right ?) after that line you can access smarty and configure it.
for example:
Code:

$smarty->template_dir = '/home/.sites/65/site131/web/php/smarty/templates';
$smarty->compile_dir = '/home/.sites/65/site131/web/php/smarty/templates_c';
(and various other things)


be sure the webserver has write-permissions to "/home/.sites/65/site131/web/php/smarty/templates_c" . thats all.

greetings
messju
Back to top
View user's profile Send private message Send e-mail Visit poster's website
twopeak
Smarty Rookie


Joined: 09 Jun 2003
Posts: 12

PostPosted: Fri Jun 20, 2003 9:31 am    Post subject: Reply with quote

uhmm, I'm still trying...
first of all, I had a problem with upercase names (I had my ftp client lowercase all filenames automaticly) I re-uploaded the latest version of smarty, with uppercase filenames

it seems like it does work better, now I get this error
Quote:
Fatal error: Failed opening required 'Smarty_Compiler.class.php' (include_path='') in /home/.sites/65/site131/web/php/smarty/libs/Smarty.class.php on line 1711



The first lines of the smarty.class.php file I have configured like this
Code:
/**
 * set SMARTY_DIR to absolute path to Smarty library files.
 * if not defined, include_path will be used.
 */

define('DIR_SEP', DIRECTORY_SEPARATOR);

/**
 * Sets SMARTY_DIR only if user application has not already defined it
 */
if (!defined('SMARTY_DIR')) {
    define('SMARTY_DIR', dirname('/home/.sites/65/site131/web/php/smarty/libs') . DIR_SEP);
}


Do I need to set DIR_SEP to a '/' or should it stay like it is?
I get the same error in both ways...[/quote]
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Fri Jun 20, 2003 10:04 am    Post subject: Reply with quote

don't change the contents of Smarty.class.php!

in your php-file simply do
Code:

require_once('/home/.sites/65/site131/web/php/smarty/libs/Smarty.class.php');


and use Smarty.class.php as it comes with 2.5.0.
after the require SMARTY_DIR is set correctly.

__FILE__ is a php-constant that holds the current filename, so SMARTY_DIR is set to the directory where Smarty.class.php is located in. that's just what you want and if that works, the compiler should be loadable also.

an alternative would be:
Code:

define('SMARTY_DIR','/home/.sites/65/site131/web/php/smarty/libs/');
require_once(SMARTY_DIR . 'Smarty.class.php');


which way to use is a matter of taste.
again: you don't have to change a single line inside Smarty.class.php for normal use.

HTH
messju
Back to top
View user's profile Send private message Send e-mail Visit poster's website
twopeak
Smarty Rookie


Joined: 09 Jun 2003
Posts: 12

PostPosted: Sun Jun 22, 2003 12:46 pm    Post subject: Reply with quote

alllllright!!!!!!!!!!!
it works!
you made me terribly happy!!!
I just re-downloaded the whole thing, putted it online and it worked! (why did I ever started to try & edit the file!! Wink

THANKS ALOT!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs 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