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

html_image

 
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 -> Language: German
View previous topic :: View next topic  
Author Message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Wed Jun 23, 2004 2:36 pm    Post subject: html_image Reply with quote

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
View user's profile Send private message
Duncan
Smarty Pro


Joined: 16 Dec 2003
Posts: 166

PostPosted: Wed Jun 23, 2004 5:10 pm    Post subject: Re: html_image Reply with quote

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
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Fri Jun 25, 2004 6:06 am    Post subject: Reply with quote

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
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Tue Jul 06, 2004 1:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
Duncan
Smarty Pro


Joined: 16 Dec 2003
Posts: 166

PostPosted: Tue Jul 06, 2004 5:37 pm    Post subject: Reply with quote

Ich wuerde die erstere Version mit dem assign benutzen, da ein eval Zwischenschritt wesentlich rechenintensiver ist.
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Tue Jul 06, 2004 7:44 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Wed Jul 07, 2004 11:07 am    Post subject: Reply with quote

alles klar, ich versuchs danke
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 -> Language: German 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