[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_content/tmpl/category/ -> blog_item.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_content
   6   *
   7   * @copyright   (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Language\Associations;
  15  use Joomla\CMS\Layout\LayoutHelper;
  16  use Joomla\CMS\Router\Route;
  17  use Joomla\CMS\Uri\Uri;
  18  use Joomla\Component\Content\Administrator\Extension\ContentComponent;
  19  use Joomla\Component\Content\Site\Helper\RouteHelper;
  20  
  21  // Create a shortcut for params.
  22  $params = $this->item->params;
  23  $canEdit = $this->item->params->get('access-edit');
  24  $info    = $params->get('info_block_position', 0);
  25  
  26  // Check if associations are implemented. If they are, define the parameter.
  27  $assocParam = (Associations::isEnabled() && $params->get('show_associations'));
  28  
  29  $currentDate   = Factory::getDate()->format('Y-m-d H:i:s');
  30  $isUnpublished = ($this->item->state == ContentComponent::CONDITION_UNPUBLISHED || $this->item->publish_up > $currentDate)
  31      || ($this->item->publish_down < $currentDate && $this->item->publish_down !== null);
  32  
  33  ?>
  34  
  35  <?php echo LayoutHelper::render('joomla.content.intro_image', $this->item); ?>
  36  
  37  <div class="item-content">
  38      <?php if ($isUnpublished) : ?>
  39          <div class="system-unpublished">
  40      <?php endif; ?>
  41  
  42      <?php echo LayoutHelper::render('joomla.content.blog_style_default_item_title', $this->item); ?>
  43  
  44      <?php if ($canEdit) : ?>
  45          <?php echo LayoutHelper::render('joomla.content.icons', array('params' => $params, 'item' => $this->item)); ?>
  46      <?php endif; ?>
  47  
  48      <?php // @todo Not that elegant would be nice to group the params ?>
  49      <?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
  50          || $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category') || $params->get('show_author') || $assocParam); ?>
  51  
  52      <?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
  53          <?php echo LayoutHelper::render('joomla.content.info_block', array('item' => $this->item, 'params' => $params, 'position' => 'above')); ?>
  54      <?php endif; ?>
  55      <?php if ($info == 0 && $params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
  56          <?php echo LayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>
  57      <?php endif; ?>
  58  
  59      <?php if (!$params->get('show_intro')) : ?>
  60          <?php // Content is generated by content plugin event "onContentAfterTitle" ?>
  61          <?php echo $this->item->event->afterDisplayTitle; ?>
  62      <?php endif; ?>
  63  
  64      <?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
  65      <?php echo $this->item->event->beforeDisplayContent; ?>
  66  
  67      <?php echo $this->item->introtext; ?>
  68  
  69      <?php if ($info == 1 || $info == 2) : ?>
  70          <?php if ($useDefList) : ?>
  71              <?php echo LayoutHelper::render('joomla.content.info_block', array('item' => $this->item, 'params' => $params, 'position' => 'below')); ?>
  72          <?php endif; ?>
  73          <?php if ($params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
  74              <?php echo LayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>
  75          <?php endif; ?>
  76      <?php endif; ?>
  77  
  78      <?php if ($params->get('show_readmore') && $this->item->readmore) :
  79          if ($params->get('access-view')) :
  80              $link = Route::_(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
  81          else :
  82              $menu = Factory::getApplication()->getMenu();
  83              $active = $menu->getActive();
  84              $itemId = $active->id;
  85              $link = new Uri(Route::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));
  86              $link->setVar('return', base64_encode(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)));
  87          endif; ?>
  88  
  89          <?php echo LayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>
  90  
  91      <?php endif; ?>
  92  
  93      <?php if ($isUnpublished) : ?>
  94          </div>
  95      <?php endif; ?>
  96  
  97      <?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
  98      <?php echo $this->item->event->afterDisplayContent; ?>
  99  </div>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer