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.

Blog Module /

Discuss the Blog Module.

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

BlogEntry is not an array problem


Go to End
Reply


501 Views

Avatar
TomMiller

Community Member, 26 Posts

25 November 2011 at 9:09pm

Hi all,
i want to extend a blogentry with a picture. I tried this code:
in BlogEntry.php i wrote a new function:
function NewsImage() {

$actualBlogEntry = DataObject::get_by_id($this->ClassName, $this->ID);
if (var_dump(isset($newsImage["NewsPicture"]))) {
return true;
};

return false;
}

and in BlogEntry.ss
<% if NewsImage %>
<img class="newsimage" src="assets/newsimages/$NewsPicture" alt="$Title" title="$Title"/>
<% end_if %>

Unfortunately i can't access $actualBlogEntry as an array like $actualBlogEntry[NewsPicture].
When using print_r $actualBlogEntry i can see NewsPicture.
Is it somehow possible to access the Blogentrymember "NewsPicture"?

TIA Tom