function the_description($words = null) { if ($this->is_object()) { if (isset($this->description) && !empty($this->description)) { $desc = $this->description; echo trim($desc); } else { $desc = strip_tags(html_entity_decode($this->content)); if (null != $words) { $desc = substr_word($desc, $words); } echo $desc; } } }
function random_items($config) { if (!empty($config['type'])) { $type = $config['type']; } else { $type = 'post'; } if (!empty($config['title'])) { $title = $config['title']; } else { $title = 'Weitere Artikel'; } if (!empty($config['limit'])) { $limit = $config['limit']; } else { $limit = '5'; } if (!empty($config['strip_content'])) { $strip_content = $config['strip_content']; } else { $strip_content = '150'; } $db = new connection(); $db->query('SELECT * FROM object WHERE type="' . $type . '" AND status=1 ORDER BY RAND() LIMIT ' . $limit); echo "<div class='sidebar-item'>"; echo "<div class='sidebar-item-head'>{$title}</div>"; while ($post = $db->fetch_array()) { echo "<div class='sidebar-item-box'>"; echo "<div class='sidebar-item-box-head'><a href='./?p={$post['id']}' rel='nofollow'>{$post['menu_title']}</a></div>"; echo "<div class='sidebar-item-box-body'>"; $this->timestamp2date($post['date']); echo "</div>"; echo "<div class='sidebar-item-box-body'>"; echo substr_word(strip_tags(html_entity_decode($post['content'])), $strip_content); echo "</div>"; echo "</div>"; } echo "</div>"; }