/** * Create an item feed. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * */ public function display($tpl = null) { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $params = $app->getParams(); $feed_email = @$app->get('feed_email') ? $app->get('feed_email') : 'creator'; // Get some data from the model $app->input->set('limit', $app->get('feed_limit')); $category = $this->get('Category'); $rows = $this->get('Items'); $doc->link = JRoute::_(KnvbapiHelperRoute::getCategoryRoute($category->id, $params->get('keep_competitie_itemid'))); foreach ($rows as $row) { // strip html from feed item title $title = $this->escape($row->name); $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); // Compute the slug $row->slug = $row->id; if ($row->alias) { $row->slug .= ':' . $row->alias; } // url link to competitie // & used instead of & as this is converted by feed creator $link = JRoute::_(KnvbapiHelperRoute::getCompetitieRoute($row->slug, $row->catid, $row->language, 'default', $params->get('keep_competitie_itemid')), false); $description = $row->description; // TODO: Only pull fulltext if necessary (actually, just get the necessary fields). $description = $params->get('feed_summary', 0) ? $description : $row->intro; $creator = $row->created_by_alias ? $row->created_by_alias : $row->creator; @($date = $row->created ? date('r', strtotime($row->created)) : ''); // load individual item creator class $item = new JFeedItem(); $item->title = $title; $item->link = $link; $item->description = $description; $item->date = $date; $item->category = $row->category; $item->creator = $creator; if ($feed_email == 'site') { $item->creatorEmail = $site_email; } else { $item->creatorEmail = $row->creator_email; } // loads item info into rss array $doc->addItem($item); } }
/** * Prepares the document */ protected function prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $lang = JFactory::getLanguage(); $pathway = $app->getPathway(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu and $menu->params->get('show_page_heading')) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', $this->item->name); } $title = $this->params->get('page_title', ''); $id = (int) @$menu->query['id']; // if the menu item does not concern this competitie if ($menu and ($menu->query['option'] != 'com_knvbapi' or $menu->query['view'] != 'competitie' or $id != $this->item->id)) { // If this is not a single competitie menu item, set the page title to the competitie name if ($this->item->name) { $title = $this->item->name; } $path = array(array('title' => $this->item->name, 'link' => '')); if ($this->params->get('show_competitie_category_breadcrumb', '0')) { $options['countItems'] = false; $options['table'] = '#__knvbapi_competities'; $category = JCategories::getInstance('Knvbapi', $options)->get($this->item->catid); while ($category and ($menu->query['option'] != 'com_knvbapi' or $menu->query['view'] == 'competitie' or $id != $category->id) and $category->id > 1) { $path[] = array('title' => $category->title, 'link' => KnvbapiHelperRoute::getCategoryRoute($category->id, $this->params->get('keep_competitie_itemid'))); $category = $category->getParent(); } } $path = array_reverse($path); foreach ($path as $item) { $pathway->addItem($item['title'], $item['link']); } } // Check for empty title and add site name if param is set if (empty($title)) { $title = htmlspecialchars_decode($app->get('sitename')); } elseif ($app->get('sitename_pagetitles', 0)) { $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->get('sitename')), $title); } if (empty($title)) { $title = $this->item->name; } $this->document->setTitle($title); // Get Menu Item meta description, Keywords and robots instruction to insert in page header if ($this->item->metadesc) { $this->document->setDescription($this->item->metadesc); } else { if (!$this->item->metadesc and $this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } } if ($this->item->metakey) { $this->document->setMetadata('keywords', $this->item->metakey); } else { if (!$this->item->metakey and $this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } } // Get Robots instruction to insert in page header if ($this->item->robots) { $this->document->setMetadata('robots', $this->item->robots); } else { if (!$this->item->robots and $this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } } if ($app->get('MetaAuthor') == '1') { $author = $this->item->created_by_alias ? $this->item->created_by_alias : $this->item->author; $this->document->setMetaData('author', $author); } // If there is a pagebreak heading or title, add it to the page title if (!empty($this->item->page_title)) { $this->item->name = $this->item->name . ' - ' . $this->item->page_title; $this->document->setTitle($this->item->page_title . ' - ' . JText::sprintf('COM_KNVBAPI_PAGEBREAK_PAGE_NUM', $this->state->get('list.offset') + 1)); } // Include Helpers JHtml::addIncludePath(JPATH_COMPONENT . '/helpers'); }
/** * Prepares the document */ protected function prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $lang = JFactory::getLanguage(); $pathway = $app->getPathway(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', JText::_('COM_KNVBAPI_CATEGORY_HEADER')); } $id = (int) @$menu->query['id']; if ($menu and ($menu->query['option'] != 'com_knvbapi' or $menu->query['view'] == 'competitie' or $id != $this->category->id)) { $path = array(array('title' => $this->category->title, 'link' => '')); $category = $this->category->getParent(); while (($menu->query['option'] != 'com_knvbapi' or $menu->query['view'] == 'competitie' or $id != $category->id) and $category->id > 1) { $path[] = array('title' => $category->title, 'link' => KnvbapiHelperRoute::getCategoryRoute($category->id, $this->params->get('keep_competitie_itemid'))); $category = $category->getParent(); } $path = array_reverse($path); foreach ($path as $item) { $pathway->addItem($item['title'], $item['link']); } } $title = $this->params->get('page_title', ''); if (empty($title)) { $title = htmlspecialchars_decode($app->get('sitename')); } elseif ($app->get('sitename_pagetitles', 0)) { $title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->get('sitename')), $title); } $this->document->setTitle($title); // Get Menu Item meta description, Keywords and robots instruction to insert in page header if ($this->category->metadesc) { $this->document->setDescription($this->category->metadesc); } elseif (!$this->category->metadesc and $this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->category->metakey) { $this->document->setMetadata('keywords', $this->category->metakey); } elseif (!$this->category->metakey and $this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } if ($app->get('MetaAuthor') == '1' and $this->category->get('author', '')) { $this->document->setMetaData('author', $this->category->get('author', '')); } if (!is_object($this->category->metadata)) { $this->category->metadata = new Registry($this->category->metadata); } $metadata = $this->category->metadata->toArray(); foreach ($metadata as $k => $v) { if ($v) { $this->document->setMetadata($k, $v); } } // Add feed links if ($this->params->get('show_feed_link', 1)) { $link = '&format=feed&limitstart='; $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); $this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs); $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); $this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs); } // Include Helpers JHtml::addIncludePath(JPATH_COMPONENT . '/helpers'); }
?> <?php $title = '<span itemprop="genre">' . $this->escape($this->item->category_title) . '</span>'; ?> <div class="formelm"> <label> <?php echo JText::_('COM_KNVBAPI_FIELD_CATEGORY_LABEL'); ?> </label> <span> <?php if ($params->get('link_competitie_category') and $this->item->catslug) { ?> <?php $url = '<a href="' . JRoute::_(KnvbapiHelperRoute::getCategoryRoute($this->item->catslug, $params->get('keep_competitie_itemid'))) . '" itemprop="url">' . $title . '</a>'; ?> <?php echo $url; ?> <?php } else { ?> <?php echo $title; ?> <?php } ?> </span>
?> <?php if ($this->params->get('show_empty_categories') or $child->getNumItems(true) or count($child->getChildren())) { if (!isset($this->children[$this->parent->id][$id + 1])) { $class = ' class="last"'; } ?> <li <?php echo $class; ?> > <?php $class = ''; ?> <span class="item-title"><a href="<?php echo JRoute::_(KnvbapiHelperRoute::getCategoryRoute($child->id, $this->params->get('keep_competitie_itemid'), $child->language)); ?> "> <?php echo $this->escape($child->title); ?> </a> </span> <?php if ($this->params->get('show_subcategories_desc') == 1) { ?> <?php if ($child->description) { ?> <div class="category-desc"> <?php