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

config for image src

 
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 -> Tips and Tricks
View previous topic :: View next topic  
Author Message
candasm
Smarty n00b


Joined: 24 Dec 2009
Posts: 3

PostPosted: Thu Dec 24, 2009 12:16 am    Post subject: config for image src Reply with quote

hello

i am just curious about .if i wanna set img tag attiribute of src with smarty config its mean like this:

its at template file code

Code:
<img src="images/hello.jpg"/>


server side its a problem need to be like that
Code:
<img src="templates/images/hello.jpg"/>


how can i set global img src i want like this
Code:
<?

$smarty->config("img"=>("attr"=>"src","type"=>"frontadd","templates/"));

?>

and when it will compile will look like this
Code:
<img src="templates/images/hello.jpg"/>


this attiribute settings can be different ofcourse Laughing but i wish i can set html tags with this style Sad

i couldnt search on forum but i hope its have a solution Question
Back to top
View user's profile Send private message
candasm
Smarty n00b


Joined: 24 Dec 2009
Posts: 3

PostPosted: Thu Dec 24, 2009 12:30 am    Post subject: Reply with quote

i was thinking and i found other easy solution but im not sure how to add it in smarty


can be like this
Code:

$smarty->srcedit("templates/");

<img {srcedit} src="images/hello.jpg" {/srcedit} />


and result same can be like this and design view wont demolish its ok ithink who can help me Smile[/code]
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Dec 24, 2009 1:14 am    Post subject: Reply with quote

Why do you have your image files in the template folder? Or why did you use the wrong path in your template?

You could simply do it like this:
Code:
$smarty->assign('imgpath','templates/');

<img src="`$imgpath`images/hello.jpg"/>
Back to top
View user's profile Send private message
candasm
Smarty n00b


Joined: 24 Dec 2009
Posts: 3

PostPosted: Thu Dec 24, 2009 4:58 pm    Post subject: Reply with quote

im useing same time with dreamweaver my template and more time im giveing little path like images/hello.jpg but if can set attr i wont work for replace all paths (:


its happening caouse of my localhost job and server side
server side path is complately different and localhost path is different too mean if icould set it like how i say willl be easy for everywhere ..
Back to top
View user's profile Send private message
DS_Ohm
Smarty n00b


Joined: 18 Jan 2010
Posts: 1

PostPosted: Fri Jan 22, 2010 9:54 am    Post subject: Reply with quote

my solution display images and link

Code:

{foreach from=$images item=v}
    <li>{html_image alt="alt" file="photos/{$v}" link="photos/$v"}</li>
{/foreach}
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 -> Tips and Tricks 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