1
votes

Within the override files of any Joomla template, various calls are made to the intro images and full text images.

I'd like to be able to place these images outside of the main article area, and be able to place it somewhere in the main template index file (like a featured div near the top of the page)

<?php echo htmlspecialchars($images->image_fulltext); ?>

This is used to call the image in the override files and content layout files, but of course this doesn't work in the template index.php file, no matter what combination of adding $this or $doc to the chain because it's not in the scope of the article itself.

Is there anyway to be able to call article specific items from the template index page?

3

3 Answers

0
votes

It sounds like you're trying to accomplish what a module is designed to do. If I understand you correctly, you should be writing a module to be published in those areas "outside of the main article area", and in the code of that module, use the input of the page to determine what article to get the image from, and display it there.

0
votes

Since you wish to render this outside the components view, you would need to use a module. You could Joomla's core module Articles - News Flash, which has an option to display images. This combined with a template override of the module layout would allow you to achieve what you want.

The other option is to hand roll your own module. I attached a link to the Joomla Developers Module homepage if you were interested in going that route.

http://docs.joomla.org/Portal:Module_Development

0
votes

thanks for your input but I actually managed to work it out using this:

$article = JTable::getInstance("content"); 
$article->load(JRequest::getInt("id"));
$article_images = $article->get("images");
$pictures = json_decode($article_images);

echo "<img src='/".$pictures->{'image_fulltext'}."'/>";

This works anywhere on the templates index.php file and will show the current articles full text image.

So after that, I did a simple IF statement wrappd around it to only show it for certain menuIDs.

It can be done!