/**
  * @param null $tpl
  *
  * @return bool
  */
 function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->params = $this->state->get('params');
     $this->item = $this->get('Item');
     $this->items = $this->get('Items');
     $this->extensions = $this->get('Extensions');
     $this->canEdit = JFactory::getUser()->authorise('core.edit', 'com_xmap.sitemap.' . $this->item->id);
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->displayer = new XmapDisplayerHtml($this->item, $this->items, $this->extensions);
     $this->displayer->setCanEdit($this->canEdit);
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->prepareDocument();
     parent::display($tpl);
     $this->getModel()->hit($this->displayer->getCount());
 }