Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • mikel2004 Friend
    #195393

    Hi!
    Can I convert the intro images to a link in category blog pages? How?

    Thanks a lot

    Saguaros Moderator
    #525150

    Hi Mikel,

    Ninja Lead did suggest you to add link for images in category blog pages here: http://www.joomlart.com/forums/topic/image-intro-article-with-link-url/#post-524250. Please have a look.

    mikel2004 Friend
    #525208

    Hi Saguaros,
    He found a solution for articles pages, not for category blog pages.

    The Ninja code works in this file:
    templates/ja_teline_iv_t3/html/com_content/article/default.php

    but not in this file:
    /templates/ja_teline_iv_t3/html/com_content/category/blog_item.php file

    Thanks

    <em>@Saguaros 414421 wrote:</em><blockquote>Hi Mikel,

    Ninja Lead did suggest you to add link for images in category blog pages here: http://www.joomlart.com/forums/topic/image-intro-article-with-link-url/#post-524250. Please have a look.</blockquote>

    Saguaros Moderator
    #525582

    His last code (14th reply) is for article and you should try the code in 12th reply for category bog

    mikel2004 Friend
    #525638

    And, (in 13th reply) I reply that I try with the code in category blog file but does not work.

    <em>@mikel2004 413592 wrote:</em><blockquote>I put your code in the /templates/ja_teline_iv_t3/html/com_content/category/blog_item.php file
    But not works 🙁
    </blockquote>

    <em>@Saguaros 414953 wrote:</em><blockquote>His last code (14th reply) is for article and you should try the code in 12th reply for category bog</blockquote>

    So, can you help me?

    Saguaros Moderator
    #526020

    It’s weird as I just tried to apply that solution at my end and it worked. Here is what I follow:

    – Open the file: templatesja_teline_iv_t3htmlcom_contentcategoryblog_item.php
    – Replace this snippet of code:


    <?php if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
    <?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
    <div class="pull-<?php echo htmlspecialchars($imgfloat); ?>"> <img
    <?php if ($images->image_intro_caption):
    echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
    endif; ?>
    src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> </div>
    <?php endif; ?>

    with:


    <a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
    <?php if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
    <?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
    <div class="pull-<?php echo htmlspecialchars($imgfloat); ?>"> <img
    <?php if ($images->image_intro_caption):
    echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
    endif; ?>
    src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> </div>
    <?php else:
    $regex = "/<img[^>]*>/";
    $image = '';
    if (preg_match_all($regex,$this->item->introtext, $matches)) {
    $this->item->introtext = preg_replace ($regex, '', $this->item->introtext);
    $image = implode ("n", $matches[0]);
    }
    ?>
    <?php if ($image): ?>
    <div class="pull-"><?php echo $image ?></div>
    <?php endif; ?>

    <?php endif; ?>
    </a>

    Please give it a try again.

    mikel2004 Friend
    #526103

    Hi Saguaros!

    Your code not working with intro images of the articles, but it works if the image are in the article code like this:
    <p><img class=”caption” src=”fotos/fichas/tribalistas-passe-em-casa.jpg” /></p>

    Can you see the differences here:
    http://veintiuno.czoom.co/videoclip

    So, what can I do to have the link in Intro images?

    Thanks!!


    1. blog-link
    Saguaros Moderator
    #526238

    Hi Mike,

    Please open the blog_item.php file above and change:


    <a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
    <?php if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
    <?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
    <div class="pull-<?php echo htmlspecialchars($imgfloat); ?>"> <img
    <?php if ($images->image_intro_caption):
    echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
    endif; ?>
    src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> </div>

    To:


    <a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>">
    <?php if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
    <?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
    <div class="pull-<?php echo htmlspecialchars($imgfloat); ?>"> <a href="<?php echo $this->item->readmore_link; ?>"><img
    <?php if ($images->image_intro_caption):
    echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
    endif; ?>
    src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> </a></div>

    Let me know if it helps.

    mikel2004 Friend
    #526292

    Regrettably, nothing change.

    My blog_item.php code, now is:

    <!– Article –>

    <?php
    $aclass = ”;
    if($params->get(‘show_create_date’)){
    $aclass = ‘ class=”has-date”‘;
    }
    ?>
    <article <?php echo $aclass ?>>

    <a href=”<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>”>
    <?php if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
    <?php $imgfloat = (empty($images->float_intro)) ? $params->get(‘float_intro’) : $images->float_intro; ?>
    <div class=”pull-<?php echo htmlspecialchars($imgfloat); ?>”> <a href=”<?php echo $this->item->readmore_link; ?>”><img
    <?php if ($images->image_intro_caption):
    echo ‘class=”caption”‘.’ title=”‘ .htmlspecialchars($images->image_intro_caption) .'”‘;
    endif; ?>
    src=”<?php echo htmlspecialchars($images->image_intro); ?>” alt=”<?php echo htmlspecialchars($images->image_intro_alt); ?>”/> </a></div>
    <?php else:
    $regex = “/<img[^>]*>/”;
    $image = ”;
    if (preg_match_all($regex,$this->item->introtext, $matches)) {
    $this->item->introtext = preg_replace ($regex, ”, $this->item->introtext);
    $image = implode (“n”, $matches[0]);
    }
    ?>
    <?php if ($image): ?>

    <div class=”pull-“><?php echo $image ?></div>
    <?php endif; ?>

    <?php endif; ?>
    </a>

    <?php if ($params->get(‘show_title’)) : ?>
    <header class=”article-header clearfix”>
    <h2 class=”article-title”>
    <?php if ($params->get(‘link_titles’) && $params->get(‘access-view’)) : ?>
    <a href=”<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>”> <?php echo $this->escape($this->item->title); ?></a>
    <?php else : ?>
    <?php echo $this->escape($this->item->title); ?>
    <?php endif; ?>
    </h2>
    </header>
    <?php endif; ?>

    <!– Aside –>
    <?php if ($hasInfo || $hasCtrl) : ?>
    <aside class=”article-tools article-aside row-fluid”>
    <div class=”span9″>
    <?php // to do not that elegant would be nice to group the params ?>
    <?php if ($hasInfo) : ?>
    <dl class=”article-info”>
    <dt class=”article-info-term”></dt>
    <?php if ($params->get(‘show_parent_category’) && $this->item->parent_id != 1) : ?>
    <dd class=”parent-category-name”>
    <?php $title = $this->escape($this->item->parent_title);
    $url = ‘<a href=”‘ . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->parent_id)) . ‘”>’ . $title . ‘</a>’; ?>
    <?php if ($params->get(‘link_parent_category’)) : ?>
    <?php echo JText::sprintf(‘COM_CONTENT_PARENT’, ‘<span>’.$url.'</span>’); ?>
    <?php else : ?>
    <?php echo JText::sprintf(‘COM_CONTENT_PARENT’, ‘<span>’.$title.'</span>’); ?>
    <?php endif; ?>
    </dd>
    <?php endif; ?>

    <?php if ($params->get(‘show_category’)) : ?>
    <dd class=”category-name”>
    <?php $title = $this->escape($this->item->category_title);
    $url = ‘<a href=”‘ . JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catid)) . ‘”>’ . $title . ‘</a>’; ?>
    <?php if ($params->get(‘link_category’)) : ?>
    <?php echo JText::sprintf(‘COM_CONTENT_CATEGORY’, ‘<span>’.$url.'</span>’); ?>
    <?php else : ?>
    <?php echo JText::sprintf(‘COM_CONTENT_CATEGORY’, ‘<span>’.$title.'</span>’); ?>
    <?php endif; ?>
    </dd>
    <?php endif; ?>

    <?php if ($params->get(‘show_create_date’)) : ?>
    <dd class=”create ja-blog-date”>
    <div class=”inner clearfix”>
    <?php
    $createDay = date(‘d’, strtotime( $this->item->created));
    $createMonth = JText::_(strtoupper(date(‘F’, strtotime($this->item->created))).”_SHORT”);
    $createYear = date(‘Y’, strtotime( $this->item->created));
    ?>
    <span class=”date”><?php echo $createDay; ?></span>
    <span class=”month-year”>
    <strong><?php echo $createMonth; ?></strong>
    <strong><?php echo $createYear; ?></strong>
    </span>

    <?php echo $this->item->event->afterDisplayTitle; ?>
    </div>
    </dd>
    <?php endif; ?>

    <?php if ($params->get(‘show_modify_date’)) : ?>
    <dd class=”modified”><?php echo JText::sprintf(‘COM_CONTENT_LAST_UPDATED’, ‘<span>’.JHtml::_(‘date’, $this->item->modified, JText::_(‘DATE_FORMAT_LC3′)).'</span>’); ?> </dd>
    <?php endif; ?>

    <?php if ($params->get(‘show_publish_date’)) : ?>
    <dd class=”published”>
    <?php echo JText::sprintf(‘COM_CONTENT_PUBLISHED_DATE_ON’, ‘<span>’.JHtml::_(‘date’, $this->item->publish_up, JText::_(‘DATE_FORMAT_LC2′)).'</span>’); ?>
    </dd>
    <?php endif; ?>

    <?php if ($params->get(‘show_author’) && !empty($this->item->author )) : ?>
    <dd class=”createdby”>
    <?php $author = $this->item->author; ?>
    <?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);?>
    <?php if (!empty($this->item->contactid ) && $params->get(‘link_author’) == true):?>
    <?php echo JText::sprintf(‘COM_CONTENT_WRITTEN_BY’ ,
    ‘<span>’.JHtml::_(‘link’, JRoute::_(‘index.php?option=com_contact&view=contact&id=’.$this->item->contactid), $author).'</span>’); ?>
    <?php else :?>
    <?php echo JText::sprintf(‘COM_CONTENT_WRITTEN_BY’, ‘<span>’.$author.'</span>’); ?>
    <?php endif; ?>
    </dd>
    <?php endif; ?>
    <?php if ($params->get(‘show_hits’)) : ?>
    <dd class=”hits”>
    <?php echo JText::sprintf(‘COM_CONTENT_ARTICLE_HITS’, $this->item->hits); ?>
    </dd>
    <?php endif; ?>
    </dl>
    <?php endif; ?>
    </div>
    <div class=”span3 pull-right”>
    <?php if ($hasCtrl) : ?>

    <ul class=”actions”>
    <?php if ($params->get(‘show_print_icon’)) : ?>
    <li class=”print-icon”> <?php echo JHtml::_(‘icon.print_popup’, $this->item, $params); ?> </li>
    <?php endif; ?>

    <?php if ($params->get(‘show_email_icon’)) : ?>
    <li class=”email-icon”> <?php echo JHtml::_(‘icon.email’, $this->item, $params); ?> </li>
    <?php endif; ?>

    <?php if ($canEdit) : ?>
    <li class=”edit-icon”> <?php echo JHtml::_(‘icon.edit’, $this->item, $params); ?> </li>
    <?php endif; ?>

    </ul>

    <?php endif; ?>
    </div>

    </aside>
    <?php endif; ?>
    <!– //Aside –>

    <section class=”article-intro clearfix”>
    <?php if (!$params->get(‘show_intro’)) : ?>
    <?php endif; ?>
    <?php echo $this->item->event->beforeDisplayContent; ?>

    <?php echo $this->item->introtext; ?>
    </section>

    <?php if ($params->get(‘show_readmore’) && $this->item->readmore) :
    if ($params->get(‘access-view’)) :
    $link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
    else :
    $menu = JFactory::getApplication()->getMenu();
    $active = $menu->getActive();
    $itemId = $active->id;
    $link1 = JRoute::_(‘index.php?option=com_users&view=login&Itemid=’ . $itemId);
    $returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
    $link = new JURI($link1);
    $link->setVar(‘return’, base64_encode($returnURL));
    endif;?>
    <div class=”readmore”>
    <a class=”btn” href=”<?php echo $link; ?>”>
    <span>
    <?php if (!$params->get(‘access-view’)) :
    echo JText::_(‘COM_CONTENT_REGISTER_TO_READ_MORE’);
    elseif ($readmore = $this->item->alternative_readmore) :
    echo $readmore;
    if ($params->get(‘show_readmore_title’, 0) != 0) :
    echo JHtml::_(‘string.truncate’, ($this->item->title), $params->get(‘readmore_limit’));
    endif;
    elseif ($params->get(‘show_readmore_title’, 0) == 0) :
    echo JText::sprintf(‘COM_CONTENT_READ_MORE_TITLE’);
    else :
    echo JText::_(‘COM_CONTENT_READ_MORE’);
    echo JHtml::_(‘string.truncate’, ($this->item->title), $params->get(‘readmore_limit’));
    endif; ?>
    </span>
    </a>
    </div>
    </section>

    <?php endif; ?>
    </article>

    I have something wrong?

    Thanks!

    Saguaros Moderator
    #526706

    It’s weird as code works fine at my end, give me more time, I will check directly in your site.

    mikel2004 Friend
    #526722

    Ok!!

    Thanks!!

    <em>@Saguaros 416332 wrote:</em><blockquote>It’s weird as code works fine at my end, give me more time, I will check directly in your site.</blockquote>

    mikel2004 Friend
    #527018

    Any news to help me?

    Thanks

    Saguaros Moderator
    #527359

    I realize that the above code is not effective when you add image of article via ‘Images and Links’ Option in backend settings of article. In videoclip page of your site, I just try to change the way of adding image by adding it directly in content of article named: Crazy Clown Time (David Lynch, 2012) and it works, please have a look: http://veintiuno.czoom.co/videoclip

    mikel2004 Friend
    #527369

    Yes, I know that. I tell you this in my post number 7:
    <em>@mikel2004 415599 wrote:</em><blockquote>Hi Saguaros!

    Your code not working with intro images of the articles, but it works if the image are in the article code like this:
    <p><img class=”caption” src=”fotos/fichas/tribalistas-passe-em-casa.jpg” /></p>

    Can you see the differences here:
    http://veintiuno.czoom.co/videoclip

    So, what can I do to have the link in Intro images?

    Thanks!!</blockquote>

    Well… I have all my articles with the image of article via ‘Images and Links’ Option.
    So, I really need that your code work for images via ‘Images and Links’.

    If you can… I really appreciate it a lot.

    Thanks again!

    <em>@Saguaros 417158 wrote:</em><blockquote>I realize that the above code is not effective when you add image of article via ‘Images and Links’ Option in backend settings of article. In videoclip page of your site, I just try to change the way of adding image by adding it directly in content of article named: Crazy Clown Time (David Lynch, 2012) and it works, please have a look: http://veintiuno.czoom.co/videoclip</blockquote>

    Saguaros Moderator
    #527393

    I upload blog_item.php file into your site and it works now. (I rename file in your site to ‘blog_item.php_backup’)

    Please have a look.

Viewing 15 posts - 1 through 15 (of 18 total)

This topic contains 18 replies, has 2 voices, and was last updated by  mikel2004 10 years, 1 month ago.

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