Date: 07/26/01
- Next message: Peter Bowyer: "[phplib] Template extensions & PHP in templates"
- Previous message: tugce tahmaz: "[phplib] system"
- Next in thread: Richard Archer: "Re: [phplib] Inserting the correct template block"
- Reply: Richard Archer: "Re: [phplib] Inserting the correct template block"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I have two template files.
index.tpl
--
{IMG}
--
and images.tpl
--
<!-- BEGIN img_block -->
<img src="images/{IMAGE}" {IMGSIZE}>
<!-- END img_block -->
<!-- BEGIN swf_block -->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"
{IMGSIZE}>
<param name=movie value="images/{IMAGE}">
<param name=quality value=high>
<embed src="images/{IMAGE}" quality=high
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="500" height="300">
</embed>
</object>
<!-- END swf_block -->
--
Now, in my PHP file, I test the image file's extension, and then depending
on whether it is flash or a plain image, I insert the correct code into
{IMG}, also assigning the image name to {IMAGE}. My problem is that I
cannot insert the correct block without deleting the others, and then I
have to put the line
$tpl->parse("IMG", "img_tags", "true");
which puts the whole file images.tpl into the template as I can't think how
to vary the parse depending on which block is left ( img_tags has been
defined using $tpl->set_file(array(..., "img_tags" => "image.tpl"));)
I'm sure I'm not using the tempate class correctly and there's something
I've missed - can someone help me please???
Thanks,
Peter.
PS: my current code is:
if(ereg("\.swf$", trim($image))) {
$tpl->del_block("img_tags", "img_block");
$tpl->set_block("img_tags", "swf_block");
} else {
$tpl->del_block("img_tags", "swf_block");
}
$tpl->parse("IMG", "img_tags", "true");
}
using the del_block extension
Class Sendcard_Template extends Template {
function del_block($container, $handle) {
$this->set_block($container, $handle);
$this->set_var($handle, "");
}
}
--oOo--
Narrow Gauge on the web - photos, directory and forums!
http://www.narrow-gauge.co.uk
--oOo--
Peter's web page - Scottish narrow gauge in 009
http://members.aol.com/reywob/
--oOo--
--
Abbestellen mit Mail an: phplib-unsubscribe <email protected>
Kommandoliste mit Mail an: phplib-help <email protected>
- Next message: Peter Bowyer: "[phplib] Template extensions & PHP in templates"
- Previous message: tugce tahmaz: "[phplib] system"
- Next in thread: Richard Archer: "Re: [phplib] Inserting the correct template block"
- Reply: Richard Archer: "Re: [phplib] Inserting the correct template block"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

