var Phenix = function () {
Troll du Web depuis 1996

Template Joomla

Ceci est un fichier de template Joomla. Comment je suis censé comprendre ce qui ce qui ce passe ?
C’est un template fourni avec le core, il devrait servir d’exemple, être facile à comprendre.

  1. <?php
  2. /**
  3.  * @package Joomla.Site
  4.  * @subpackage com_content
  5.  *
  6.  * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
  7.  * @license GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC') or die;
  11.  
  12. // Create a shortcut for params.
  13. $params = $this->item->params;
  14. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
  15. $canEdit = $this->item->params->get('access-edit');
  16. $info = $params->get('info_block_position', 0);
  17. ?>
  18. <?php if ($this->item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate())
  19. || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != JFactory::getDbo()->getNullDate())) : ?>
  20. <div class="system-unpublished">
  21. <?php endif; ?>
  22.  
  23. <?php echo JLayoutHelper::render('joomla.content.blog_style_default_item_title', $this->item); ?>
  24.  
  25. <?php if ($canEdit || $params->get('show_print_icon') || $params->get('show_email_icon')) : ?>
  26. <?php echo JLayoutHelper::render('joomla.content.icons', array('params' => $params, 'item' => $this->item, 'print' => false)); ?>
  27. <?php endif; ?>
  28.  
  29. <?php if ($params->get('show_tags') && !empty($this->item->tags->itemTags)) : ?>
  30. <?php echo JLayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>
  31. <?php endif; ?>
  32.  
  33. <?php // Todo Not that elegant would be nice to group the params ?>
  34. <?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
  35. || $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category') || $params->get('show_author') ); ?>
  36.  
  37. <?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
  38. <?php echo JLayoutHelper::render('joomla.content.info_block.block', array('item' => $this->item, 'params' => $params, 'position' => 'above')); ?>
  39. <?php endif; ?>
  40.  
  41. <?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>
  42.  
  43.  
  44. <?php if (!$params->get('show_intro')) : ?>
  45. <?php // Content is generated by content plugin event "onContentAfterTitle" ?>
  46. <?php echo $this->item->event->afterDisplayTitle; ?>
  47. <?php endif; ?>
  48. <?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
  49. <?php echo $this->item->event->beforeDisplayContent; ?>
  50.  
  51. <?php echo $this->item->introtext; ?>
  52.  
  53. <?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
  54. <?php echo JLayoutHelper::render('joomla.content.info_block.block', array('item' => $this->item, 'params' => $params, 'position' => 'below')); ?>
  55. <?php endif; ?>
  56.  
  57. <?php if ($params->get('show_readmore') && $this->item->readmore) :
  58. if ($params->get('access-view')) :
  59. $link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language));
  60. else :
  61. $menu = JFactory::getApplication()->getMenu();
  62. $active = $menu->getActive();
  63. $itemId = $active->id;
  64. $link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false));
  65. $link->setVar('return', base64_encode(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)));
  66. endif; ?>
  67.  
  68. <?php echo JLayoutHelper::render('joomla.content.readmore', array('item' => $this->item, 'params' => $params, 'link' => $link)); ?>
  69.  
  70. <?php endif; ?>
  71.  
  72. <?php if ($this->item->state == 0 || strtotime($this->item->publish_up) > strtotime(JFactory::getDate())
  73. || ((strtotime($this->item->publish_down) < strtotime(JFactory::getDate())) && $this->item->publish_down != JFactory::getDbo()->getNullDate())) : ?>
  74. </div>
  75. <?php endif; ?>
  76.  
  77. <?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
  78. <?php echo $this->item->event->afterDisplayContent; ?>

Un message, un commentaire ?

modération a priori

Ce forum est modéré a priori : votre contribution n’apparaîtra qu’après avoir été validée par un administrateur du site.

Qui êtes-vous ?
Votre message
  • Pour créer des paragraphes, laissez simplement des lignes vides.