Hi,
I'm trying to do this too - I think I've followed through the steps suggested above, but it doesn't seem to be finding the function.
Have put:
function RandomImage( $strLeftDirName )
{
if ( !is_string( $strLeftDirName ) )
{
return false;
}
$left_dir = DataObject::get_one("Folder", "Name = \"$strLeftDirName\"");
$randImg = ( $left_dir->ID ) ? DataObject::get_one("Image", "ParentID = $left_dir->ID", true, "RAND()" ) : false;
return $randImg->Filename;
}
function init() {
parent::init();
Requirements::themedCSS("style");
}
in Page.php, and have put:
<img src="$RandomImage(assets/Uploads)" />
in Page.ss.
I'm just getting:
<img src="" >
No error message... what am I missing?
thanks,
Ben