[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_content/tmpl/article/ -> default.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\HTML\HTMLHelper;
  15  use Joomla\CMS\Language\Associations;
  16  use Joomla\CMS\Language\Text;
  17  use Joomla\CMS\Layout\FileLayout;
  18  use Joomla\CMS\Layout\LayoutHelper;
  19  use Joomla\CMS\Router\Route;
  20  use Joomla\CMS\Uri\Uri;
  21  use Joomla\Component\Content\Administrator\Extension\ContentComponent;
  22  use Joomla\Component\Content\Site\Helper\RouteHelper;
  23  
  24  // Create shortcuts to some parameters.
  25  $params  = $this->item->params;
  26  $canEdit = $params->get('access-edit');
  27  $user    = Factory::getUser();
  28  $info    = $params->get('info_block_position', 0);
  29  $htag    = $this->params->get('show_page_heading') ? 'h2' : 'h1';
  30  
  31  // Check if associations are implemented. If they are, define the parameter.
  32  $assocParam        = (Associations::isEnabled() && $params->get('show_associations'));
  33  $currentDate       = Factory::getDate()->format('Y-m-d H:i:s');
  34  $isNotPublishedYet = $this->item->publish_up > $currentDate;
  35  $isExpired         = !is_null($this->item->publish_down) && $this->item->publish_down < $currentDate;
  36  ?>
  37  <div class="com-content-article item-page<?php echo $this->pageclass_sfx; ?>" itemscope itemtype="https://schema.org/Article">
  38      <meta itemprop="inLanguage" content="<?php echo ($this->item->language === '*') ? Factory::getApplication()->get('language') : $this->item->language; ?>">
  39      <?php if ($this->params->get('show_page_heading')) : ?>
  40      <div class="page-header">
  41          <h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
  42      </div>
  43      <?php endif;
  44      if (!empty($this->item->pagination) && !$this->item->paginationposition && $this->item->paginationrelative) {
  45          echo $this->item->pagination;
  46      }
  47      ?>
  48  
  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 ($params->get('show_title')) : ?>
  53      <div class="page-header">
  54          <<?php echo $htag; ?> itemprop="headline">
  55              <?php echo $this->escape($this->item->title); ?>
  56          </<?php echo $htag; ?>>
  57          <?php if ($this->item->state == ContentComponent::CONDITION_UNPUBLISHED) : ?>
  58              <span class="badge bg-warning text-light"><?php echo Text::_('JUNPUBLISHED'); ?></span>
  59          <?php endif; ?>
  60          <?php if ($isNotPublishedYet) : ?>
  61              <span class="badge bg-warning text-light"><?php echo Text::_('JNOTPUBLISHEDYET'); ?></span>
  62          <?php endif; ?>
  63          <?php if ($isExpired) : ?>
  64              <span class="badge bg-warning text-light"><?php echo Text::_('JEXPIRED'); ?></span>
  65          <?php endif; ?>
  66      </div>
  67      <?php endif; ?>
  68      <?php if ($canEdit) : ?>
  69          <?php echo LayoutHelper::render('joomla.content.icons', array('params' => $params, 'item' => $this->item)); ?>
  70      <?php endif; ?>
  71  
  72      <?php // Content is generated by content plugin event "onContentAfterTitle" ?>
  73      <?php echo $this->item->event->afterDisplayTitle; ?>
  74  
  75      <?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
  76          <?php echo LayoutHelper::render('joomla.content.info_block', array('item' => $this->item, 'params' => $params, 'position' => 'above')); ?>
  77      <?php endif; ?>
  78  
  79      <?php if ($info == 0 && $params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
  80          <?php $this->item->tagLayout = new FileLayout('joomla.content.tags'); ?>
  81  
  82          <?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
  83      <?php endif; ?>
  84  
  85      <?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
  86      <?php echo $this->item->event->beforeDisplayContent; ?>
  87  
  88      <?php if ((int) $params->get('urls_position', 0) === 0) : ?>
  89          <?php echo $this->loadTemplate('links'); ?>
  90      <?php endif; ?>
  91      <?php if ($params->get('access-view')) : ?>
  92          <?php echo LayoutHelper::render('joomla.content.full_image', $this->item); ?>
  93          <?php
  94          if (!empty($this->item->pagination) && !$this->item->paginationposition && !$this->item->paginationrelative) :
  95              echo $this->item->pagination;
  96          endif;
  97          ?>
  98          <?php if (isset($this->item->toc)) :
  99              echo $this->item->toc;
 100          endif; ?>
 101      <div itemprop="articleBody" class="com-content-article__body">
 102          <?php echo $this->item->text; ?>
 103      </div>
 104  
 105          <?php if ($info == 1 || $info == 2) : ?>
 106              <?php if ($useDefList) : ?>
 107                  <?php echo LayoutHelper::render('joomla.content.info_block', array('item' => $this->item, 'params' => $params, 'position' => 'below')); ?>
 108              <?php endif; ?>
 109              <?php if ($params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
 110                  <?php $this->item->tagLayout = new FileLayout('joomla.content.tags'); ?>
 111                  <?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
 112              <?php endif; ?>
 113          <?php endif; ?>
 114  
 115          <?php
 116          if (!empty($this->item->pagination) && $this->item->paginationposition && !$this->item->paginationrelative) :
 117              echo $this->item->pagination;
 118              ?>
 119          <?php endif; ?>
 120          <?php if ((int) $params->get('urls_position', 0) === 1) : ?>
 121              <?php echo $this->loadTemplate('links'); ?>
 122          <?php endif; ?>
 123          <?php // Optional teaser intro text for guests ?>
 124      <?php elseif ($params->get('show_noauth') == true && $user->get('guest')) : ?>
 125          <?php echo LayoutHelper::render('joomla.content.intro_image', $this->item); ?>
 126          <?php echo HTMLHelper::_('content.prepare', $this->item->introtext); ?>
 127          <?php // Optional link to let them register to see the whole article. ?>
 128          <?php if ($params->get('show_readmore') && $this->item->fulltext != null) : ?>
 129              <?php $menu = Factory::getApplication()->getMenu(); ?>
 130              <?php $active = $menu->getActive(); ?>
 131              <?php $itemId = $active->id; ?>
 132              <?php $link = new Uri(Route::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false)); ?>
 133              <?php $link->setVar('return', base64_encode(RouteHelper::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language))); ?>
 134              <?php echo LayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>
 135          <?php endif; ?>
 136      <?php endif; ?>
 137      <?php
 138      if (!empty($this->item->pagination) && $this->item->paginationposition && $this->item->paginationrelative) :
 139          echo $this->item->pagination;
 140          ?>
 141      <?php endif; ?>
 142      <?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
 143      <?php echo $this->item->event->afterDisplayContent; ?>
 144  </div>


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