/** * Using Streams and a number of other functions to gather categories and images * this function builds a complete Product array for use in a number of places * and pages for display. * * @param integer or string $id_slug The ID or Slug of a Product to query * @return array A complete product array or FALSE on nothing found * @access public */ public function get_product($id_slug) { // Set params $params = array('stream' => 'firesale_products', 'namespace' => 'firesale_products', 'where' => (is_numeric($id_slug) ? 'id = ' : 'slug = ') . "'{$id_slug}' AND status = 1", 'limit' => '1', 'order_by' => 'id', 'sort' => 'desc'); // Get entries $product = $this->streams->entries->get_entries($params); // Check exists if ($product['total'] > 0) { // Get and format product data $product = current($product['entries']); $product['snippet'] = truncate_words($product['description']); $product['category'] = $this->get_categories($product['id']); $product['image'] = $this->get_single_image($product['id']); // Return return $product; } // Nothing? return FALSE; }
if (!empty($tracking) and in_array($item['track'], $tracking->t)) { ?> viewed<?php } ?> "> <h3 class="jobTitle"><span class="pubDate"><?php echo $item['pubDate']; ?> </span> <?php echo $item['title']; ?> </h3> <p> <?php echo truncate_words(strip_tags($item['description']), 300); ?> </p> </div> <div class="bd"> <h3><?php echo $item['title']; ?> </h3> <h4 class="jobDate"><?php echo $item['pubDate']; ?> </h4> <div class="jobDescription"> <?php if (stripos('<p>', $item['description']) !== false) {
/** * Renders the field for a cell in a table-view * * @return mixed|string */ public function renderForTable() { return truncate_words(strip_tags($this->getFieldValue()), 10); }