Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Send more than 1 param from template to a model function?


Reply

4 Posts   1305 Views

Avatar
msantang

11 May 2007 at 10:30am Community Member, 41 Posts

How can i send more than 1 parameter from template to this function?

class ProductPage_Image extends Image {
   function generateThumbnail(GD $gd, $width, $heigth) {
      $gd->setQuality(90);
      return $gd->paddedResize($width,$heigth,"F0F0F0");
   }
   
   public function Thumbnail($width,$heigth)
   {
      return $this->getFormattedImage('Thumbnail',$width, $heigth);
   }
}

i try:

<ul id="ListaProductos">
<% control Children %>
<li>
<div class="Productonombre"><a href="$Link">$Title</a></div>
<div class="Productofoto">$Foto.Thumbnail(80,70)</div>
<div class="Productodescripcion"><p>$Content.FirstSentence</p></div>
</li>
<% end_control %>

But dint work, i get 1 parameter missing for Thumbnail function.

Thanks

Avatar
Sam

11 May 2007 at 3:52pm Administrator, 685 Posts

The templating language has some weird little quirks in it.

Instead of:

$Foto.Thumbnail(80,70)

Try:
<% control Foto %>
$Thumbnail(80,70)
<% end_control %>

While we're on the subject, if anyone want to try and help rewrite the SSViewer parser, I'd be very appreciative and happy to point them in the right direction. :-)

Basically, it's currently built as a mess of regular expression search-and-replaces. It needs to be turned into a more sophisicated parser that uses a regular expression to find the <% control %> and $ tags, and something based on explode() and a for loop to work out how to parse the field/method reference itself.

Avatar
msantang

11 May 2007 at 11:23pm Community Member, 41 Posts

Thanks i will give it a try.

Avatar
msantang

12 May 2007 at 9:56am Community Member, 41 Posts

Yes, That resolve my problem tank you very much.