SV: [SMARTY] return img tag

From: Date: Mon, 16 Dec 2002 11:10:39 +0000
Subject: SV: [SMARTY] return img tag
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6823@lists.php.net to get a copy of this message
$smarty->assign("IMAGE", $IMAGE); > -----Oprindelig meddelelse----- > Fra: Peter Pieczora [mailto:ppieczora@dsl.ca] > Sendt: 16. december 2002 08:14 > Til: smarty-general@lists.php.net > Emne: [SMARTY] return img tag > > > Hi, > I am trying to display images which attributes are stored in db. > Here is what I've done so far: > > index.php > //---------- > $query = "SELECT * FROM c_image WHERE imid='$imid'"; > $res = mysql_query($query); > while ($data = mysql_fetch_array ($res)) > { > $imid .= $data[imid]; > $basefile .= $data[file]; > $width .= $data[width]; > $height .= $data[height]; > $border .= $data[border]; > $alt .= $data[alt]; > } > $smarty->assign("file", "$file"); > $smarty->assign("width", "$width"); > $smarty->assign("height", "$height"); > $smarty->assign("border", "$border"); > $smarty->assign("alt", "$alt"); > $IMAGE="<IMG SRC=\"$file\" WIDTH=\"$width\" > HEIGHT=\"$height\" > BORDER=\"$border\" ALT=\"$alt\">"; > $smarty->assign("IMAGE", "$IMAGE"); > //-------- > page.tpl > {$IMAGE} > ------------ > So when I enter ?page&imid=x on URL bar image gets displayed. > > What I'm trying to come up with is how to pass variable {$IMAGE} > which would > allow me to display image based on $imid, from the template? > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.smarty.general (#6823) next »