protected function displayPreview($entries) { $entry = $this->admin_general_options($this->url0); $entry_array = array(); if (isset($entries[0]['title'])) { foreach ($entries as $e) { $e['site-url'] = SITE_URL; // Format the date from the timestamp $e['date'] = date('F d, Y', $e['created']); // Image options if (!empty($e['img'])) { // Display the latest two galleries $e['image'] = $e['img']; $e['preview'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'preview/', $e['img']); $e['thumb'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'thumbs/', $e['img']); } else { $e['image'] = '/assets/images/no-image.jpg'; $e['preview'] = '/assets/images/no-image.jpg'; $e['thumb'] = '/assets/images/no-image-thumb.jpg'; } $e['comment-count'] = comments::getCommentCount($e['id']); $e['comment-text'] = $e['comment-count'] == 1 ? "comment" : "comments"; $e['url'] = !empty($e['data6']) ? $e['data6'] : urlencode($e['title']); $e['tags'] = $this->_formatTags($e['data2']); $e['admin'] = $this->admin_simple_options($this->url0, $e['id']); $entry_array[] = $e; } $template_file = $this->url0 . '-preview.inc'; } else { $entry_array[] = array('admin' => NULL, 'title' => 'No Entry Found', 'body' => "<p>That entry doesn't appear to exist.</p>"); $template_file = 'blog-preview.inc'; } if ($this->url1 == "category") { $extra['header']['title'] = "Entries Tagged with " . ucwords(str_replace('-', ' ', $this->url2)); } else { $extra['header']['title'] = "Recent Entries"; } $extra['footer']['pagination'] = $this->paginateEntries(); /* * Load the template into a variable */ $template = UTILITIES::loadTemplate($template_file); $entry .= UTILITIES::parseTemplate($entry_array, $template, $extra); return $entry; }
protected function displayResults($entries) { $entry = $this->admin_general_options($this->url0); $entry_array = array(); if (isset($entries[0]['title'])) { foreach ($entries as $e) { $e['site-url'] = SITE_URL; // Format the date from the timestamp $e['date'] = date('F d, Y', $e['created']); // Image options if (!empty($e['img']) && strlen($e['img']) > 1) { // Display the latest two galleries $e['image'] = $e['img']; $e['preview'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'preview/', $e['img']); $e['thumb'] = str_replace(IMG_SAVE_DIR, IMG_SAVE_DIR . 'thumbs/', $e['img']); } else { $e['image'] = '/assets/images/no-image.jpg'; $e['preview'] = '/assets/images/no-image.jpg'; $e['thumb'] = '/assets/images/no-image-thumb.jpg'; } $e['comment-count'] = comments::getCommentCount($e['id']); $e['comment-text'] = $e['comment-count'] == 1 ? "comment" : "comments"; $e['url'] = !empty($e['data6']) ? $e['data6'] : urlencode($e['title']); $e['admin'] = $this->admin_simple_options($this->url0, $e['id']); $entry_array[] = $e; } $template_file = $this->url0 . '.inc'; } else { $entry_array[] = array('admin' => NULL, 'title' => 'No Entries Found That Match Your Search', 'body' => "<p>No entries match that query.</p>"); $template_file = 'default.inc'; } $extra['header']['title'] = 'Search Results for "' . urldecode($this->url2) . '" (' . $this->getEntryCountBySearch($this->url2, $this->url1) . ' entries found)'; $extra['footer']['pagination'] = $this->paginateEntries(); /* * Load the template into a variable */ $template = UTILITIES::loadTemplate($template_file); $entry .= UTILITIES::parseTemplate($entry_array, $template, $extra); return $entry; }