The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Fri Feb 17, 2012 4:39 pm 
Joomla! Intern
Joomla! Intern

Joined: Thu Jan 10, 2008 4:42 pm
Posts: 64
Location: Italy
Ok, joomla 2.5 it's out and finally gets the intro-image in a similar way wordpress does. Great I love it and makes the life much more easy (especially for external editors)
I also implemented the thimthumb to resize pictures on the fly as my intro-div has been loaded on frontpage. See down here.

But now my question is: how to get the intro image inside our newsflash modules ?? It's weird now using the before-readmore-firstpic of the article. Having the intro image inside newsflash could be the best natural evolution. Probably no one on joomla team got enought time to update the newsflash mod as it should be...
Is anyone able to help me pulling out from joomla the string to the intro pic path of each article showing on mod_newsflash ?

Anyone, let me know..!

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="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 $this->baseurl ?>/templates/mytemplate/js/timthumb.php?src=<?php echo $this->baseurl ?>/<?php echo htmlspecialchars($images->image_intro); ?>&amp;h=150&amp;w=150&amp;zc=1" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
   </div>
<?php endif; ?>


Top
 Profile  
 
PostPosted: Sat Feb 18, 2012 9:23 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 18, 2012 10:28 am
Posts: 8
Location: Russia
I have this problem.
How access to intro_image in mod_articles_news?
I'm try get $images in file: /templates/iv-template/html/mod_articles_news/_item.php with no results.


Top
 Profile  
 
PostPosted: Sat Feb 18, 2012 1:53 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 18, 2012 10:28 am
Posts: 8
Location: Russia
I'm solve this problem and add instructions to tracker: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28086


Top
 Profile  
 
PostPosted: Sun Feb 19, 2012 10:15 am 
Joomla! Intern
Joomla! Intern

Joined: Thu Jan 10, 2008 4:42 pm
Posts: 64
Location: Italy
Added it on helper.php but I still get an apty space with this:
Code:
 <img src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 10:10 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 18, 2012 10:28 am
Posts: 8
Location: Russia
Add follow line to /templates/your_template/html/mod_articles_news/_item.php
Code:
$images = json_decode($item->images);

After this:
Code:
defined('_JEXEC') or die;


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 10:46 am 
Joomla! Intern
Joomla! Intern

Joined: Thu Jan 10, 2008 4:42 pm
Posts: 64
Location: Italy
Ok did it ! Works great now.

What about helper.php override ?
I already had a look around and didnt find a way to add that a.images call by a template override. Looks like it's impossible to override helper.php isnt it ?

So we're again here to mod the core files :-) ? not a prob after all.
The workaround it's creating a completely new module. With timthumb ersize features I would say that I'm creating something totally new !


Top
 Profile  
 
PostPosted: Mon Feb 20, 2012 11:23 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 18, 2012 10:28 am
Posts: 8
Location: Russia
Override helper.php the most correct way. But, we need to wait until the fix is in the Joomla (I hope it will be in next update). By the way, too, url's are not working for the same reason.

The new module is needed if this current functionality is not enough. In my needs thumbs proportions differ from the proportions of the original image, which requires manual work and control. The idea is good, need a good implementation.


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 10:25 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jul 15, 2009 9:06 pm
Posts: 14
This is exactly what I want to do, but when I put dansky's code

Quote:
Code:
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="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 $this->baseurl ?>/templates/mytemplate/js/timthumb.php?src=<?php echo $this->baseurl ?>/<?php echo htmlspecialchars($images->image_intro); ?>&amp;h=150&amp;w=150&amp;zc=1" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
   </div>
<?php endif; ?>


in my template override _item.php it breaks the layout at
Code:
<div class="img-intro-
and only displays the start of the module (all other modules, components, template are not displayed).

Is there something wrong with the code, or is there a specific place I should be putting it?

I'm using Beez20 on Joomla2.5


Top
 Profile  
 
PostPosted: Fri Mar 02, 2012 6:47 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 18, 2012 10:28 am
Posts: 8
Location: Russia
wahahey, probably disrupted the structure of the module.
My _item.php file (based on Gantry default template):
Code:
<?php
/**
 * @package   Template Overrides - RocketTheme
 * @version   3.2.15 January 25, 2012
 * @author    RocketTheme http://www.rockettheme.com
 * @copyright Copyright (C) 2007 - 2012 RocketTheme, LLC
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 *
 * Rockettheme Gantry Template uses the Joomla Framework (http://www.joomla.org), a GNU/GPLv2 content management system
 *
 */

// no direct access
defined('_JEXEC') or die;

$images = json_decode($item->images);      //for intro images

?>
<?php if ($params->get('item_title')) : ?>

   <<?php echo $params->get('item_heading'); ?> class="newsflash-title <?php echo $params->get('moduleclass_sfx'); ?>">
   <?php if ($params->get('link_titles') && $item->link != '') : ?>
      <a href="<?php echo $item->link;?>">
         <?php echo $item->title;?></a>
   <?php else : ?>
      <?php echo $item->title; ?>
   <?php endif; ?>
   </<?php echo $params->get('item_heading'); ?>>

<?php endif; ?>

<?php /** For Intro Image **/ if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
   <?php $imgfloat = (empty($images->float_intro)) ? $item->params->get('float_intro') : $images->float_intro; ?>
   <div class="img-intro-<?php echo htmlspecialchars($imgfloat); ?>">      
      <a href="<?php echo $item->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 /** End For Intro Image **/endif; ?>

<?php if (!$params->get('intro_only')) :
   echo $item->afterDisplayTitle;
endif; ?>

<?php echo $item->beforeDisplayContent; ?>

<?php echo $item->introtext; ?>

<?php if (isset($item->link) && $item->readmore && $params->get('readmore')) :
   echo '<a class="readon" href="'.$item->link.'"><span>'.$item->linkText.'</span></a>';
endif; ?>


Top
 Profile  
 
PostPosted: Fri Mar 02, 2012 8:37 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jul 15, 2009 9:06 pm
Posts: 14
VARion

I must have been putting it in the wrong position as you say - working perfectly now.

Thank you!


Top
 Profile  
 
PostPosted: Sun Apr 15, 2012 6:51 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sun Apr 15, 2012 6:47 am
Posts: 2
I'd love to find a way to apply this solution to mod-articles-category.

I want to display the image_intro as a background image behind the article summary, but like the mod-article-news issue, the images field doesn't get loaded.
Any thoughts?


Top
 Profile  
 
PostPosted: Thu Jun 28, 2012 2:42 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jan 23, 2008 8:05 pm
Posts: 27
2inchesofwater wrote:
I'd love to find a way to apply this solution to mod-articles-category.

I want to display the image_intro as a background image behind the article summary, but like the mod-article-news issue, the images field doesn't get loaded.
Any thoughts?


I'm trying to get it to work with mod_articles_category too, but no luck... Have you found a solution yet?

Thanks.


UPDATE:
Just solved it.

just after the foreach loop, paste this line:
<?php $images = json_decode($item->images); ?>

and then this will work:
<img width="200" height="41" src="<?php echo htmlspecialchars($images->image_fulltext); ?>" alt="<?php echo htmlspecialchars($images->image_fulltext_alt); ?>" />


Top
 Profile  
 
PostPosted: Thu Feb 21, 2013 9:42 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Fri Dec 16, 2011 6:13 pm
Posts: 1218
Location: Millersburg, OH
VARion, thank you very much for posting your solution. It's exactly what I needed.

_________________
Ryan
Numinous Productions
Custom Joomla Templates, Joomla Troubleshooting and Personalized Tutorials
http://www.numinousmedia.com


Top
 Profile  
 
PostPosted: Fri Jun 13, 2014 3:22 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri Feb 12, 2010 8:36 pm
Posts: 76
Awesome topic. Totally worked for my newsflash module:).

I am now trying to get it to display the category image of a sub-category.

I found out this code requests it:
Code:
blog.php
<?php if (!empty($this->children[$this->category->id]) && $this->maxLevel != 0) : ?>
      <div class="cat-children">
         <?php if ($this->params->get('show_category_heading_title_text', 1) == 1) : ?>
            <h3> <?php echo JTEXT::_('JGLOBAL_SUBCATEGORIES'); ?> </h3>
         <?php endif; ?>
         <?php echo $this->loadTemplate('children'); ?> </div>
   <?php endif; ?>


Then it requests from childeren:
Code:
blog_children.php
   <?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
   <?php //start mod?>
         <div class="item-image">
         <?php echo '<img src="'.json_decode($child->params)->image . '" />'; ?>
         </div>
   <?php // end mod?>

Images get displayed, but when there is no image it displays regardless (!). Can someone explain how I rewrite this so that it doesn't display if there is no image to be retrieved? I am really bad at php, I got this to work through trial and error :P.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 



Who is online

Users browsing this forum: Google Adsense [Bot], syhussaini and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group