Viewing 1 post (of 1 total)
  • Author
    Posts
  • jooservices Friend
    #205893

    There are so many topic about this issue. Actually we still can bypass it by use around way. But ya. Still consider it’s a bug from Teline V.

    I have just checked into source to know root cause, by this way we’ll know how to fix or solve it.

    Note:// This topic is tips & tricks. It’s not tutorial with step by step to do. The only thing i provided here is all about logic concept. You can implement it by your own way.

    # Checked with quickstart and latest template & T3

    <blockquote>

    <version>1.0.3</version>
    <creationDate>24 April 2015</creationDate>

    <name>T3 Framework</name>
    <creationDate>April 3, 2015</creationDate>
    <version>2.4.8</version>

    </blockquote>

    # In this sample we’ll inspect with content plugin: load module.
    It’s triggered via event onContentPrepare

    # Now we need inspect how does com_content trigger this event. Let use view article as sample.

    // Process the content plugins.

    JPluginHelper::importPlugin('content');
    $dispatcher->trigger('onContentPrepare', array('com_content.article', &$item, &$this->params, $offset));
    $item->event = new stdClass;
    $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$this->params, $offset));
    $item->event->afterDisplayTitle = trim(implode("n", $results));

    $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$this->params, $offset));
    $item->event->beforeDisplayContent = trim(implode("n", $results));

    $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$this->params, $offset));
    $item->event->afterDisplayContent = trim(implode("n", $results));

    componentscom_contentviewsarticleview.html.php

    Here we are. In this code we can see $item is passed to onContentPrepare as reference variable. Inside content plugin: Load module. It’ll be processed and replace with modules html.
    But which property will use ?

    preg_match_all($regex, $article->text, $matches, PREG_SET_ORDER);

    !!! Most important here.
    Event article have intro / full text but text is processed . !!!


    if ($item->params->get('show_intro', '1') == '1')
    {
    $item->text = $item->introtext . ' ' . $item->fulltext;
    } elseif ($item->fulltext)
    {
    $item->text = $item->fulltext;
    } else
    {
    $item->text = $item->introtext;
    }

    It’s mean we need to use text instead fulltext / introtext ! Note it into your mind.

    # Everything above is all about Joomla! core process.
    Now we check into override in template

    <?php echo JATemplateHelper::render($this->item, 'joomla.content.item', array('print' => $this->print, 'item' => $this->item, 'params' => $this->params)) ?>

    Oki T3 use wrapped method to render layouts


    /* render content item base on content type */

    public static function render($item, $path, $displayData)
    {
    $attribs = new JRegistry($item->attribs);
    $content_type = $attribs->get('ctm_content_type', 'article');
    // try to render the content with content type layout
    $html = JLayoutHelper::render($path . '.' . $content_type, $displayData);
    if (!$html)
    {
    // render with default layout
    $html = JLayoutHelper::render($path . '.default', $displayData);
    }
    return $html;
    }

    In my sample content type is gallery. Than i’ll check this layout.

    <div class="magazine-item-ct" itemprop="description">
    <?php if ($aparams->get('show_intro', 0)) : ?>
    <blockquote class="article-intro">
    <?php echo $item->introtext; ?>
    </blockquote>
    <?php endif; ?>

    <section class="article-content">
    <?php echo JLayoutHelper::render('joomla.content.info_block.topic', array('item' => $item)); ?>
    <?php echo $item->fulltext; ?>
    </section>
    </div>

    Pingo !!!
    Remember ? Joomla! use text instead introtext & fulltext. But we’r using introtext / fulltext .

    Some tutorial asked to replace with text here. And we’ll have another issue “duplicate”. Of course because above there is no condition to filter intro / full text .

    That’s all .
    Now we can implement it by ourself way 😉 Easier for now .

    Thank you,
    Viet Vu

Viewing 1 post (of 1 total)

This topic contains 1 reply, has 1 voice, and was last updated by  jooservices 9 years, 7 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum