Example #1
0
 public static function getPlaceholder($placeholder)
 {
     $object = new self();
     $strContent = "";
     $addStmt = "";
     $db = \Database::getInstance();
     $placeholderId = is_numeric($placeholder) ? $placeholder : 0;
     $placeholderAlias = is_string($placeholder) ? $placeholder : 0;
     if (!BE_USER_LOGGED_IN) {
         $time = time();
         $addStmt = " AND (start='' OR start<{$time}) AND (stop='' OR stop>{$time}) AND published=1";
     }
     // TODO: make a Placeholder Model!!
     $objPlaceholder = $db->prepare("SELECT * FROM tl_dps_placeholder WHERE (id=? OR alias=?)" . $addStmt)->limit(1)->execute($placeholderId, $placeholderAlias);
     if ($objPlaceholder->numRows > 0) {
         $objPlaceholder = $objPlaceholder->first();
         $id = $objPlaceholder->id;
         $objContent = \ContentModel::findPublishedByPidAndTable($id, "tl_dps_placeholder");
         if ($objContent && $objContent->count() > 0) {
             while ($objContent->next()) {
                 $strContent .= $object->replaceInsertTags($object->getContentElement($objContent->id));
             }
         }
     }
     return $strContent;
 }