Module_articles

Réduire
X
 
  • Filtrer
  • Heure
  • Afficher
Tout effacer
nouveaux messages

  • Module_articles

    Bonjour à tous

    J'ai modifié le mod_articles/default_items.php pour avoir l'image d'intro (ligne 41) au-dessus du titre (ligne 42) avec un lien sur chacun des deux

    Mais je n'arrive pas à regrouper les deux pour avoir un seul lien

    Code PHP:
    <?php
    /**
     * @package Joomla.Site
     * @subpackage mod_articles
     *
     * Copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
     * @license GNU General Public License version 2 or later; see LICENSE.txt
     */
    defined('_JEXEC') or die;
    use 
    Joomla\CMS\HTML\HTMLHelper;
    use 
    Joomla\CMS\Language\Text;
    use 
    Joomla\CMS\Layout\LayoutHelper;
    if (
    $params->get('articles_layout') == 1) {
        
    $gridCols = 'grid-cols-' . $params->get('layout_columns');
    }
    ?>
    <ul class="mod-articles-items<?php echo ($params->get('articles_layout') == 1 ? ' mod-articles-grid ' . $gridCols : ''); ?> mod-list">
        <?php foreach ($items as $item) : ?>
            <?php
            $displayInfo 
    = $item->displayHits || $item->displayAuthorName || $item->displayCategoryTitle || $item->displayDate;
            
    ?>
            <li>
                <article class="mod-articles-item" itemscope itemtype="https://schema.org/Article">
                    <?php if ($params->get('item_title') || $displayInfo || $params->get('show_tags') || $params->get('show_introtext') || $params->get('show_readmore')) : ?>
                        <div class="mod-articles-item-content infos-pratiques">
                            <?php if ($params->get('item_title')) : ?>
                                <?php $item_heading = $params->get('item_heading', 'h4'); ?>
                                <<?php echo $item_heading; ?> class="mod-articles-title" itemprop="name">
                                    <?php if ($params->get('link_titles') == 1) : ?>
                                        <?php $attributes = ['class' => 'mod-articles-link ' . $item->active, 'itemprop' => 'url']; ?>
                                        <?php $link = htmlspecialchars($item->link, ENT_COMPAT, 'UTF-8', false); ?>
                                        <?php $img_intro = LayoutHelper::render('joomla.content.' . $params->get('img_intro_full') . '_image', $item); ?>
                                        <?php $title = htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8', false); ?>
                                        <?php echo HTMLHelper::_('link', $link, $img_intro); ?> /** ligne 41
                                        <?php echo HTMLHelper::_('link', $link, $title, $attributes); ?> /** ligne 42
                                    <?php endif; ?>
                                </<?php echo $item_heading; ?>>
                            <?php endif; ?>
                        </div>
                    <?php endif; ?>
                </article>
            </li>
        <?php endforeach; ?>
    </ul>​
    ​
    Merci pour votre aide ou votre direction
    Cordialement, Bruno28

    Joomla! 6.2 - php 8.5 - bp2i.fr

    >>> Adhérez à l'AFUJ : https://www.joomla.fr/association/adherer <<<

    Joomladay 2026
    >>> ​Réservez la date du Joomladay 2026 : ​https://www.joomla.fr/association-af...aday-2026.html <<<

  • #2
    Si ça peut servir à d'autres

    J'ai remplacé les lignes 41 et 42 par

    Code PHP:
    <a href="<?php echo $link; ?>">
        <div class="vignette-img">
            <?php echo $img_intro; ?>
        </div>
        <h2 class="vignette-title">
            <?php echo $title; ?>
        </h2>
    </a>  ​
    ​

    Le code n'est peut-être pas très propre mais ça fonctionne !
    Cordialement, Bruno28

    Joomla! 6.2 - php 8.5 - bp2i.fr

    >>> Adhérez à l'AFUJ : https://www.joomla.fr/association/adherer <<<

    Joomladay 2026
    >>> ​Réservez la date du Joomladay 2026 : ​https://www.joomla.fr/association-af...aday-2026.html <<<

    Commentaire

    Annonce

    Réduire
    Aucune annonce pour le moment.

    Partenaire de l'association

    Réduire

    Hébergeur Web PlanetHoster
    Travaille ...
    X