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

Linking and Smarty

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


Joined: 08 Jan 2004
Posts: 3

PostPosted: Thu Jan 08, 2004 6:13 am    Post subject: Linking and Smarty Reply with quote

Ok, so this maybe a stupid question, but I haven't been able to find the answer in the documentation or on the board, but whenever I try and do a link with the parameter href, smarty does not interpret it the way i want it. For example if I do this in the .tpl file

<a href="www.google.com">logout</a>

It does not actually link to
www.google.com but the link is listed like this:

http://mydomain.com/www.google.com

What could be the problem? Any help is much appreciated. Thanks.


Last edited by thomas22 on Wed May 05, 2010 10:53 pm; edited 1 time in total
Back to top
View user's profile Send private message
andre
Smarty Pro


Joined: 23 Apr 2003
Posts: 164
Location: Karlsruhe, Germany

PostPosted: Thu Jan 08, 2004 7:28 am    Post subject: Reply with quote

That's the way HTML and HTTP works... Wink

Try <a href="http://www.google.com">logout</a>. This should work. Otherwise your browser will think it's a relative url (e.g. http://mydomain.com/www.google.com) instead of an absolute one.
Back to top
View user's profile Send private message
thomas22
Smarty n00b


Joined: 08 Jan 2004
Posts: 3

PostPosted: Thu Jan 08, 2004 1:09 pm    Post subject: Reply with quote

I should have clarified. The behavior I described above also applies to linking to a CSS file and images. So for a link like this:

&lt;img src="header.gif"&gt;

or a link like this:

&lt;link rel="stylesheet" type="text/css" href="layout.css" /&gt;

Smarty is looking for the header.gif and layout.css at these respective locations:

http://mydomain.com/header.gif
http://mydomain.com/layout.css

instead of looking for them in the same directory as the .tpl file. Whereas if it was straight html, it would look in the same directory as the .tpl file.

I'm just wondering if I have a configuration problem or if this is just how Smarty works and I would have to define something like this to link to the style sheet or images:

&lt;link rel="stylesheet" type="text/css" href="http://mydomain.com/layoutDirectory/layout.css" /&gt;

Again, thank you for your help.


Last edited by thomas22 on Wed May 05, 2010 10:53 pm; edited 1 time in total
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Thu Jan 08, 2004 1:15 pm    Post subject: Reply with quote

smarty doesn't look after images or css files at all. your browser does. and it does it relative to the php-file you called that called $smarty->display() and not relative to where the templates are. the templates may be not accessible by the browser at all (below the webroot).
Back to top
View user's profile Send private message Send e-mail Visit poster's website
thomas22
Smarty n00b


Joined: 08 Jan 2004
Posts: 3

PostPosted: Thu Jan 08, 2004 6:04 pm    Post subject: Reply with quote

Ok, thanks for the clarification and all the help.
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