|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Wed Sep 08, 2004 2:48 pm Post subject: |
|
|
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
Thanks in advance ! |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Sep 08, 2004 3:25 pm Post subject: |
|
|
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 |
|
maltre Smarty Rookie
Joined: 17 Aug 2004 Posts: 15
|
Posted: Wed Sep 08, 2004 3:38 pm Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Sep 08, 2004 3:55 pm Post subject: |
|
|
[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 |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed Sep 08, 2004 5:26 pm Post subject: |
|
|
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 |
|
|
|
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
|