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

The same templates_c problem :(
Goto page Previous  1, 2
 
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 -> Installation and Setup
View previous topic :: View next topic  
Author Message
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Wed Sep 08, 2004 2:48 pm    Post subject: Reply with quote

Is there anybody that could help me out with this ?
Or paste his code/configuration here that (s)he uses on his/her website ?

I've been trying all day and still nothing,
Waisting all my beautiful time on something this stupid Sad

Thanks in advance !
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Sep 08, 2004 3:25 pm    Post subject: Reply with quote

There is not enough information in your post to help you. Maybe a sample of PHP code, a sample of template code, and a sample of rendered output that demonstrates the problem?

Check the debug console output, see that everything is present, then check the paths to your images and class files in the output, see if they look right.
Back to top
View user's profile Send private message Visit poster's website
maltre
Smarty Rookie


Joined: 17 Aug 2004
Posts: 15

PostPosted: Wed Sep 08, 2004 3:38 pm    Post subject: Reply with quote

I think I found the solution, nevermind

files in root (/home/maltre/knicks4life/):
index.php
vars.php

folders in root:
images
scripts
settings
classes
smarty

folder "smarty" has a critical class.template.php file that every page on the website needs.
folder "classes" has all the class.something.php files, which are also needed on each page
Same for folder "settings" which has functions.php, errors.php, ...

folder "scripts" has more php files, the actual scripts for the site.
folder "image" has all the images.


So basically, I inserted in vars.php the following:
[php:1:ef052e6d33]define('BASEDIR', realpath(dirname(__FILE__)) . '/');
define('SITE_ROOT', realpath(dirname(__FILE__)) . '/');
define('BASEDIR', SITE_ROOT);
define("SMARTY_DIR", SITE_ROOT."smarty/libs/");
define("LAYOUT_DIR", SITE_ROOT."layout/");
define("CLASS_DIR", SITE_ROOT."classes/");
define("IMAGES_DIR", SITE_ROOT."images/");
define("INCLUDE_DIR", SITE_ROOT."settings/");

require_once($INCLUDE_DIR . "errors.php");
require_once($INCLUDE_DIR . "functions.php");
require_once($CLASS_DIR ."class.conn.php");
require_once($CLASS_DIR."class.article.php");
require_once($SMARTY_DIR."class.template.php");[/php:1:ef052e6d33]

On each page:
[php:1:ef052e6d33]require_once("/home/maltre/knicks4life/vars.php");
require_once(SMARTY_DIR."class.K4LTemplate.php");[/php:1:ef052e6d33]


Problem is, when running this, all my images and stylesheets are f'ed, the source is : "http://www.knicks4life.com/home/.macaronikillern/maltre/knicks4life/images/image.jpg".


I think I found the solution, nevermind
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Sep 08, 2004 3:55 pm    Post subject: Reply with quote

[php:1:9fcb3cf2aa]require_once($INCLUDE_DIR . "errors.php");
require_once($INCLUDE_DIR . "functions.php");
require_once($CLASS_DIR ."class.conn.php");
require_once($CLASS_DIR."class.article.php");
require_once($SMARTY_DIR."class.template.php");[/php:1:9fcb3cf2aa]

Constants don't need dollar signs btw...
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


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

PostPosted: Wed Sep 08, 2004 5:26 pm    Post subject: Reply with quote

This is a guess as I don't know based on what you posted, but it *sounds* like you are requesting a server page from a sub folder of your root and that it does not take into account that that file has a different relative path to your images. Recall, it is not the relative path of template to image that matters but rather, requested php file to images that matters. What I do is use a config var {#ImageUrl#} which has the correct server path (not file system path!) to my image dir and then in my templates I use that to refer to them. Call me old-fashioned (I realize that relative paths have a sex appeal to them) but IMO, you need to determine your absolute paths during startup so as to avoid relative headaches.
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 -> Installation and Setup All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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