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

relative links in smarty template

 
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
tobya
Smarty n00b


Joined: 04 May 2003
Posts: 1

PostPosted: Sun May 04, 2003 11:05 pm    Post subject: relative links in smarty template Reply with quote

Hello,

I've just started using smarty, and so far I am very happy with what I've seen. however, I have one rather difficult problem. Links.

I am assuming that web designers (not programmers) should be able to use smarty to design a page how they like, around the smarty tags that will provide the content.

Now I've read about all the functions for inserting files, how to create custom functions to insert correct links etc, but it leaves me with the same problem, what to do about relative links?

Most "Designed" web pages will have at least two relative links in them, a <Link > tag to import a css style sheet, and a good few IMG tags to put in logos, gifs of various kinds.

Now perhaps I'm being really stupid and if I am could someone point me in the right direction and I'll be on my way.

So the designer designs, gets his page looking right there in Dreamweaver or whatever and saves his file with a tpl extension to the directory I've told him.

myweb/templates/

styles sheets are here.

myweb/styles/

images here.

myweb/images/

so all the links start with ../ you get the point.

now my php files that load these templates are in myweb/

bang as soon as I load a template all the urls point to non existant files.

Now I know I could specify the path trough php and put {$ relative_path}style.css or some such, or <% etc %> . But If I do this then Dreamweaver and a browser (unless you working with a websserver) will not recognise and you wont allow your designer to design his documents properly (no facility to see wysiwyg css is pretty big).

I though of a way around this which basically consists of all your php files being the same level of depth as the template files.
e
eg.

myweb/php/

however is there an easier way, have I missed something fundamental Embarassed , am I wasting everyones time Confused - if so could someone please put me on the right track and I apologise.

Thanks for listening.

Toby Allen.
Back to top
View user's profile Send private message
boots
Administrator


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

PostPosted: Wed May 07, 2003 12:48 am    Post subject: Reply with quote

Hi tobya.

I don't use Dreamweaver (or wysiwg tools) so excuse me if I get this incorrect!

Directory layout:

- it is not a good idea to have your template directory under your root path for your site. You should put it in a directory that the webserver can not reach.

- you can rearrange your dirs like this:

WEB:
myweb/styles/
myweb/images/
ie. keep it the same, except remove the templates dir.

TEMPLATES:
templates/
templates/styles
templates/images

When your designers are done, copy the templates/styles and templates/images to the myweb/* directories. I don't know how this wil actually work, but its what I would try.

See Also: http://smarty.incutio.com/?page=ConfiguringDreamweaver
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