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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

function returns no value


Go to End


1434 Views

Avatar
dacar

Community Member, 173 Posts

7 October 2009 at 12:10pm

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.