1770 Posts in 495 Topics by 531 members
Blog Module
SilverStripe Forums » Blog Module » BlogEntry is not an array problem
Discuss the Blog Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 295 Views |
-
BlogEntry is not an array problem

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
| 295 Views | ||
|
Page:
1
|
Go to Top |

