-2

This question already has an answer here:

i use the menu item type "category blog". For the articles in my Category i set a Intro Image which will be shown on the left side of the blog entry. At the moment it is only possible to open the full article when you click on the title of the blog entry.

Now, what i want is, that i can click on the title AND the intro image to open the full article! Is that possible? And how can i achieve it?

Additional information: i use joomla version 3.3.6 and the afterburner2 template with gantry framework.

Thanks for any help!

oodoloo

Edit #2 (Findings after first Response)

Thanks for your reply Anibal!

Okay, generally i think i understand what to do, but it doesn't work the way i want :)...

I tried the following before i want to add the Article-Link to the image:

First i edited the file "intro_image.php" at the location templates/my_template/html/layouts/joomla/content.

I changed Line 18 to

echo 'class="caption test"' . ' title="' . htmlspecialchars($images->image_intro_caption) . '"';

After that i excepted, when i inspect the site with developer tools, that i will find an img-Tag with the additional class "test". But i cant't find it. I think that was the override-variant!?

In the next step i changed the file "intro_image.php" at the location layouts/joomla/content in the same way, but after that I still could not detect any changes when i inspect the site again.

That's the first problem. With that changes, i only want to ensure that i'm on the correct place for my changes.

In the article i also set a caption, so that the edited line should be processed!

The second problem i will have:

You say, that i have to edit line 41 to reach my needs, but i'm not sure in which way. Can you give one more example please? Sorry, but i still at the beginning of my php/joomla career ;)...

marked as duplicate by FFrewin, Toni Marie, johanpw, jonboy, Valentin Despa Nov 24 '14 at 19:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Sorry FFrewin, i understand that this is a duplicate post. yes. But i still have the problem that my changes doesn't work. I read the other post and try to use the solution there, but with no success and therefore i asked here for help again. hope it's okay... – oodoloo Nov 17 '14 at 18:38
  • I gave you a the link to get a complete workable override for the intro-image layout. But if you change the core file and you see no change, then maybe you should check inside your template's html file, if there are overrides for the com_content, category, that might not use the core intro-image layout. – FFrewin Nov 17 '14 at 18:45
  • i don't know where i have to start, to find out which file i have to edit to get the result i want. Is the template's html file the index.php in the templates-folder? where can i find it? And what are the key-lines i have to look for? – oodoloo Nov 17 '14 at 19:07
  • Just read carefully all the information provided in the answers and the comments. If you feel confused - take a step back and try again later. – FFrewin Nov 17 '14 at 19:31
3

Yes, you can change components/com_content/views/category/tmpl/blog_item.php.

In that file, line 55, it shows how to generate an Url to the article:

$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));

In line 41, it shows how the images is generated:

<?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>

You can combine both to add the link to the image.

In addition, remember to create blog_item.php as a layout component override at template level (instead of changing the core file). http://docs.joomla.org/Understanding_Output_Overrides#Layouts

-1

Ok, i found the solution. All the information provided above were correct and helped me to solve it completely. Thank you! The central issue was that i do my changes in the wrong file! I think that the template "Afterburner2" doesn't use neither the core files (under _sitename\layouts\joomla\content\intro_image.php) from joomla nor the files for override (under _sitename\templates_templateName\html\layouts\joomla\content). When you want to change the intro_image part and you use the "Afterburner2"-Template you have to edit the File under _sitename\plugins\system\gantry\overrides\3.3\2.5\com_content\category\blog_item.php. On Line 123-132 you can find the part for the intro_image.

<?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="img-intro-<?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>

A working solution looks like that:

    <?php 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;
?>

<?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="img-intro-<?php echo htmlspecialchars($imgfloat); ?>">
        <a href="<?php echo $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 endif; ?>

It is not exactly like the solution here Similar Solution

You have to conform the code a little bit.

Thanks for each Tip i get!

Additionally i want to say, that i think i edited the core files which the Template afterburner2 uses...it is not a override i think. I will look for it, but if somebody know a better way to do, for example a override, i would be glad of another solution.

After a little more research and antoher hints from FFrewin (again "Thank you" at this point :)) i think a found another solution without edit the core-file!

I copied the file "blog_item.php" from the Folder _sitename\plugins\system\gantry\overrides\3.3\2.5\com_content\category (where the core files stored) to the following location _sitename\templates\_templateName\html\joomla\3.3\com_content\category. When the file is stored there and contains the modifications i described before it also works for me.

The Folder _sitename\templates\_templateName\html\joomla does exist but in there only the folders "3.0", "3.1", "3.2" does exist. Because i use the the Joomla-Version "3.3.6" at the moment, i have to create the folder "3.3" manually. In the folder "3.3" i created another folder "com_content" and in there a folder "category", so that i ended at the path i told before. In the folder "category" i copied the file blog_item.php from _sitename\plugins\system\gantry\overrides\3.3\2.5\com_content\category.

I think that is a better solution, because you must not touch the core files.

  • You should not touch the core files of the gantry plugin. First of all make sure you are using the latest version of gantry. Also see at this google group about similar layout overrides issues in Gantry - This post might be also useful. – FFrewin Nov 17 '14 at 20:52
  • Okay, i followed your links you provided for me and i think i found a better solution and so i must not touch the core files. I edited my solution i wrote before. – oodoloo Nov 17 '14 at 21:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.