return img tag

From: Date: Mon, 16 Dec 2002 07:14:25 +0000
Subject: return img tag
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6814@lists.php.net to get a copy of this message
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?

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