Page 1 of 1

Show Banner Description

Posted: Fri Aug 23, 2013 1:17 pm
by pisandelli
My project aims to build a full Joomla Website using as much as it can of default Joomla components.
I have to build an Image Carousel with the Twitter Bootstrap component. Through from Joomla Override, i'm trying to do it using only the Joomla's Default Banner Component.
My problem is: I don't know how to show Banner's description. Why I can not find this fields in module options to show on page? If I can't use (or show them) why they are there?

I can show the Banner title using:

Code: Select all

<?php $item->name ?>
but when I try to use

Code: Select all

<?php $item->description ?>
nothing appears.

Thanks!

Re: Show Banner Description

Posted: Sat Aug 24, 2013 4:43 am
by iextensions
you want to show description when view in Banner module?

Re: Show Banner Description

Posted: Sun Aug 25, 2013 12:15 pm
by pisandelli
iextensions wrote:you want to show description when view in Banner module?
I want to show Banner Description in the frontend. What I suposed to do is a Banner Carosel using just the Joomla Banner component. So, I need the Image (OK), Need Banner Title (Ok. Using override i can get it using $item->name;) and I need the description to put above the title.
The banner will link to an article, and i can add the link (ok).
Searching more deeply I found this code. I used it in my mod_banner override.

Code: Select all

<?php 
     /** Description from the Banner  **/
     $db = &JFactory::getDBO();
         $bid = $item->id;
         $sql = "SELECT `description` FROM `rlz1b_banners` WHERE '$bid'"; 
                 /*rlz1b_banners is your database name*/
         $db->setQuery($sql);
         $db->query();
         $res = $db->loadAssocList(); 
?>
<p><?php  echo $res[0][description]; ?></p>
It worked fine, but I still don't get why this is not default in model... com_banners\models\banners.php
I can add 'a.description as description' in $jquery->select, but if i get an update, I'll lost the work.
This approach using override is the best, for sure.

Thanks for the reply!!

Re: Show Banner Description

Posted: Wed Sep 23, 2015 6:14 pm
by cjmicro
Thank you for this, very helpful! :)

Re: Show Banner Description

Posted: Sat Nov 21, 2015 11:01 pm
by Seanstex
pisandelli wrote:
iextensions wrote:you want to show description when view in Banner module?
It worked fine, but I still don't get why this is not default in model... com_banners\models\banners.php
I can add 'a.description as description' in $jquery->select, but if i get an update, I'll lost the work.
This approach using override is the best, for sure.

Thanks for the reply!!
I have the same issue with Joomla 3.4.5. I'm trying to figure out where at within the banner over ride file, the code goes? Can I just slap it anywhere? I tried doing this but it doesn't work?