|
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 |
candasm Smarty n00b
Joined: 24 Dec 2009 Posts: 3
|
Posted: Thu Dec 24, 2009 12:16 am Post subject: config for image src |
|
|
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 but i wish i can set html tags with this style
i couldnt search on forum but i hope its have a solution |
|
Back to top |
|
candasm Smarty n00b
Joined: 24 Dec 2009 Posts: 3
|
Posted: Thu Dec 24, 2009 12:30 am Post subject: |
|
|
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 [/code] |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Dec 24, 2009 1:14 am Post subject: |
|
|
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 |
|
candasm Smarty n00b
Joined: 24 Dec 2009 Posts: 3
|
Posted: Thu Dec 24, 2009 4:58 pm Post subject: |
|
|
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 |
|
DS_Ohm Smarty n00b
Joined: 18 Jan 2010 Posts: 1
|
Posted: Fri Jan 22, 2010 9:54 am Post subject: |
|
|
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 |
|
|
|
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
|