Jump to:

3393 Posts in 976 Topics by 852 members

Template Questions

SilverStripe Forums » Template Questions » function returns no value

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

Page: 1
Go to End
Author Topic: 835 Views
  • dacar
    Avatar
    Community Member
    168 Posts

    function returns no value Link to this post

    Hi,

    one structure of my site is:
    page->ReferenzCategoryHolder->ReferenzCategory->Referenz

    ReferenzCategoryHolder and ReferenzCategory are extending page. Referenz extends dataobject.

    ReferenzCategory:

    static $has_many = array(
       'Referenzen' => 'Referenz',
       'Stammdaten' => 'Stammdaten'
       );

    In stammdaten.php i have placed my functions:

    class Stammdaten_Thumbnail extends Image {
       
          function generateThumbLogo($gd) {
          $gd = $gd->PaddedResize(160, 90, "000000");

          $gd->setQuality(100);
          return $gd;
          }
          
          function generateThumbLogoGrey($gd) {
          $gd = $gd->PaddedResize(160, 90, "000000")->greyscale();

          $gd->setQuality(100);
          return $gd;
          }
          function generateThumbLogoColor($gd) {
          $gd = $gd->PaddedResize(160, 90, "000000");

          $gd->setQuality(100);
          return $gd;
          }
          
          function generateThumbLogoLaufband($gd) {
          $gd = $gd->resizeByHeight(30);

          $gd->setQuality(100);
          return $gd;
          }
    }

    in referenzCategory.ss i call the ThumbLogo function and it returns the thumbnail.

    <% control getFirma %>
       <div style="margin-bottom:10px;"><img src="$LogoDetailuebersicht.ThumbLogo.URL" title="$Firmenname, $Ort" alt="$Firmenname, $Ort" class="logo" /></div>
    <% end_control %>

    How can i use the function in referenzCategoryHolder.ss? $LogoDetailuebersicht.ThumbLogo.URL does not return anything.
    How can i debug the scope of my functions?

    Greetings from germany, Carsten.

    835 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.