Im trying this:
function BlogEntries($limit=4) {
$Blog = DataObject::get_one('BlogHolder', "Name = '".$this->blogname."'");
if ($Blog) {
$highlight = DataObject::get("BlogEntry",
"ParentID = $Blog->ID AND find_in_set('highlight',Tags)",
"Date DESC", "", 1);
if (!$highlight) {
return DataObject::get("BlogEntry",
"ParentID = $Blog->ID",
"Date DESC", "", $limit);
} else {
return DataObject::get("BlogEntry",
"ParentID = $Blog->ID AND NOT ID = $highlight->ID",
"Date DESC", "", $limit);
}
} else {
return false;
}
}
EDIT: Any way to show code using monospaced font or something similar?
But highlight->ID translates to nothing and the SQL spit it out as Couldn't run query: ....WHERE (ParentID = 1 AND NOT ID = ) AND ...