Show Banner Description

Everything to do with Joomla! 3.x templates and templating.

Moderator: General Support Moderators

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.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
User avatar
pisandelli
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Tue Jul 21, 2009 8:27 pm
Location: Fortaleza Ceará

Show Banner Description

Post by pisandelli » Fri Aug 23, 2013 1:17 pm

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!

iextensions
I've been banned!
Posts: 1498
Joined: Fri Jul 12, 2013 5:37 pm
Contact:

Re: Show Banner Description

Post by iextensions » Sat Aug 24, 2013 4:43 am

you want to show description when view in Banner module?

User avatar
pisandelli
Joomla! Apprentice
Joomla! Apprentice
Posts: 36
Joined: Tue Jul 21, 2009 8:27 pm
Location: Fortaleza Ceará

Re: Show Banner Description

Post by pisandelli » Sun Aug 25, 2013 12:15 pm

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!!

cjmicro
Joomla! Intern
Joomla! Intern
Posts: 54
Joined: Tue May 27, 2008 11:59 pm

Re: Show Banner Description

Post by cjmicro » Wed Sep 23, 2015 6:14 pm

Thank you for this, very helpful! :)

Seanstex
Joomla! Apprentice
Joomla! Apprentice
Posts: 41
Joined: Thu Jun 11, 2009 7:37 am

Re: Show Banner Description

Post by Seanstex » Sat Nov 21, 2015 11:01 pm

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?


Locked

Return to “Templates for Joomla! 3.x”