|
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 |
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Wed Jun 23, 2004 2:36 pm Post subject: html_image |
|
|
Hallo zusammen,
warum wird aus folgendem Template folgende Source?
Tpl:
Code: |
{ html_image file="images/inactive.gif" href="?section=$sSection&action=visibility/show&id=$oProduct->getId()" alt="Diesen Menu-Eintrag aktivieren"}
|
Source:
Code: |
<a href="?section=product/list&action=visibility/show&id=Object->getId()"><img src="images/inactive.gif" alt="Diesen Menu-Eintrag aktivieren" border="0" width="11" height="11" /></a>
|
Warum ersetzt er mir das $oProduct->getId() nicht durch den richtigen wert, den diese funktion zurückliefert? |
|
Back to top |
|
Duncan Smarty Pro
Joined: 16 Dec 2003 Posts: 166
|
Posted: Wed Jun 23, 2004 5:10 pm Post subject: Re: html_image |
|
|
Die Funktion befindet sich in "" und wird somit als Text ausgegeben. Du koenntest die URL vorher einer Variablen zuweisen und wuerdest dann mittels href=$foo die gewuenschte URL erhalten. |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Fri Jun 25, 2004 6:06 am Post subject: |
|
|
meinst du so?
Code: |
{assign var="sImgSrc" value="?section=$sSection&action=visibility/show&id=$oProduct->getId()"}
{ html_image file="images/inactive.gif" href="$sImgSrc" alt="Diesen Menu-Eintrag aktivieren"}
|
|
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Tue Jul 06, 2004 1:41 pm Post subject: |
|
|
könnte das auch so klappen?
Code: |
{ html_image file="images/inactive.gif" href=eval( "?section=$sSection&action=visibility/show&id=$oProduct->getId()") alt="Diesen Menu-Eintrag aktivieren"}
|
|
|
Back to top |
|
Duncan Smarty Pro
Joined: 16 Dec 2003 Posts: 166
|
Posted: Tue Jul 06, 2004 5:37 pm Post subject: |
|
|
Ich wuerde die erstere Version mit dem assign benutzen, da ein eval Zwischenschritt wesentlich rechenintensiver ist. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Jul 06, 2004 7:44 pm Post subject: |
|
|
ich würde das href einfach aus dem html_image rausnehmen:
Code: | <a href="?section=$sSection&action=visibility/show&id={$oProduct->getId()}"> {html_image file="images/inactive.gif" alt="Diesen Menu-Eintrag aktivieren"}</a>
|
wenn's unbeding ins tag mit rein soll hilft sprintf:
Code: | {html_image file="images/inactive.gif"
href="?section=%s&action=visibility/show&id=%s"|sprintf:$sSection:$oProduct->getId() alt="Diesen Menu-Eintrag aktivieren"} |
(beides ungetestet) |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Wed Jul 07, 2004 11:07 am Post subject: |
|
|
alles klar, ich versuchs danke |
|
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
|