Forum Index >  glFusion >  glFusion Add-on, Plugin Support New Topic Post Reply
 {album_title} in Random Image Block
   |  Printable Version
By: ofey (offline)  Sep 06 2009 09:02 am (Read 2062 times)  
ofey

Hi,

In random_block.thtml how could I get the 'Browse Album' link to actually be the name of the album which the random image is from? I tried replacing {lang_browse_album} with {album_title}. But this didn't work.

PHP Formatted Code
{# begin {templatelocation} #}
{framecss}
<div class="mgPluginMI">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin:0px auto;">
    <tr>
      <td align="center" style="vertical-align:middle;">
        {media_thumbnail}
      </td>
    </tr>
    <tr>
      <td style="text-align:center;">
        <div class="pluginSmallText">{media_title}</div>
         <!--- <a href="{url_album}">{lang_browse_album}</a> --->
         <a href="{url_album}">{album_title}</a>
      </td>
    </tr>
  </table>
</div>
{# end {templatelocation} #}



This is not an important issue but if anyone has any ideas I'd love to hear them.

Thanks,

Shane

Forum Active Member
Active Member


Group Comfort
Level:
: +3

Registered: 02/19/06
Posts: 349
Location: Dublin, Ireland

Profile Email Website  
  Quote
By: Manny (offline)  Sep 06 2009 17:10 pm  
Manny

Shane

I am so new to this that I shouldn't be answering, but we have a fresh install of glFusin and Media Galley with the random photo in the right block. Clicking the photo does take us to the correct album.

Got to think it is something in the configuration - but what, I'm not sure.

The best gardens are made not by planting more flowers but by picking more weeds.


Forum Regular Member
Regular Member

Group Comfort
Level:
: +4

Registered: 03/07/08
Posts: 97
Location: PA

Profile Email    
  Quote
By: Mark (offline)  Sep 06 2009 18:06 pm  
Mark

Unfortunately, the template variables must be defined in the code. So when you used {album_title}, it doesn't display anything because the PHP code never defined it. We woud need to modifiy the SQL that pulls the information since the album title is not actually known or used by the random image functions.

Thanks!
Mark

Forum Admin
Admin

Group Comfort
Level:
: +110

Registered: 10/21/05
Posts: 6331
Location: The Great State of
Texas

Profile      
  Quote
By: ofey (offline)  Sep 07 2009 02:36 am  
ofey

Mark,

I thought it was something like that alright.

I have a go at it later.

Thanks,

Shane

Forum Active Member
Active Member

Group Comfort
Level:
: +3

Registered: 02/19/06
Posts: 349
Location: Dublin, Ireland

Profile Email Website  
  Quote
By: ofey (offline)  Sep 07 2009 10:15 am  
ofey

Mark,

Is that change made somewhere is /private/sql/ or actually in the sql database?

Thanks,

Shane

Forum Active Member
Active Member


Group Comfort
Level:
: +3

Registered: 02/19/06
Posts: 349
Location: Dublin, Ireland

Profile Email Website  
  Quote
By: lgarner (offline)  Sep 07 2009 14:00 pm  
lgarner

In the query. Here's how I did it:

Edit private/plugins/mediagallery/functions.inc and change 2 lines. Note the changes in bold.
Line 2296:
$sql = "SELECT ma.album_id,m.media_id,m.media_filename,m.media_title,a.album_title FROM {$_TABLES['mg_albums']} as a LEFT JOIN {$_TABLES['mg_media_albums']} as ma

Line 2393:
'lang_browse_album' => htmlspecialchars($row['album_title']),

If you upgrade Mediagallery, you'll have to make these changes again. So, this looks like a good idea for a feature request, perhaps as a global config option.

Forum Admin
Admin

Group Comfort
Level:
: +52

Registered: 06/10/08
Posts: 1914

Profile Email Website  
  Quote
By: ofey (offline)  Sep 07 2009 16:42 pm  
ofey

Igarner,

Thanks for your reply. In /private/plugins/mediagallery/functions.inc I changed line 2391 to

PHP Formatted Code
'lang_browse_album' =>  htmlspecialchars($row['album_title']),


and line 2296 - 2298 now reads

PHP Formatted Code
    $sql = "SELECT ma.album_id,m.media_id,m.media_filename,m.media_title,a.album_title FROM {$_TABLES['mg_albums']} as a LEFT JOIN {$_TABLES['mg_media_albums']} as ma
            on a.album_id=ma.album_id LEFT JOIN {$_TABLES['mg_media']} as m on ma.media_id=m.media_id WHERE
            m.media_type=0 AND a.enable_random=1 AND a.hidden=0 " . COM_getPermSQL('and') . " ORDER BY " . $randomSelect . " LIMIT 1";


Unfotunately there is no change on the site. I just get 'Browse Album' as a link.

Thanks,

Shane

Forum Active Member
Active Member

Group Comfort
Level:
: +3

Registered: 02/19/06
Posts: 349
Location: Dublin, Ireland

Profile Email Website  
  Quote
By: ofey (offline)  Sep 07 2009 16:45 pm  
ofey

Am I being stupid hereQuestion Question Question When it says 'htmlspecialchars' is that literally to be put in as I have done or is there an actual html special character I should be putting in?

Shane

Forum Active Member
Active Member


Group Comfort
Level:
: +3

Registered: 02/19/06
Posts: 349
Location: Dublin, Ireland

Profile Email Website  
  Quote
By: lgarner (offline)  Sep 07 2009 19:36 pm  
lgarner

Yes, you have it right. htmlspecialchars() is a function to escape characters that are "special' to HTML: >, <, etc. It may not be required here, but I wasn't sure.

In your first post you indicated that you commentd out {lang_browse_album} and replaced it with {album_title}. If that's still the case you need to set the album_title variable, not lang_browse_album.

I didn't change any templates in my example.

Forum Admin
Admin

Group Comfort
Level:
: +52

Registered: 06/10/08
Posts: 1914

Profile Email Website  
  Quote
By: ofey (offline)  Sep 08 2009 05:17 am  
ofey

Igarner,

Unfortunately that's not the problem as I corrected that in random_block.thtml

PHP Formatted Code
{# begin {templatelocation} #}
{framecss}
<div class="mgPluginMI">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin:0px auto;">
    <tr>
      <td align="center" style="vertical-align:middle;">
        {media_thumbnail}
      </td>
    </tr>
    <tr>
      <td style="text-align:center;">
        <div class="pluginSmallText">{media_title}</div>
              <a href="{url_album}">{lang_browse_album}</a>
      </td>
    </tr>
  </table>
</div>
{# end {templatelocation} #}



Thanks,

Shane

Forum Active Member
Active Member


Group Comfort
Level:
: +3

Registered: 02/19/06
Posts: 349
Location: Dublin, Ireland

Profile Email Website  
  Quote
By: ofey (offline)  Sep 08 2009 05:32 am  
ofey

By the way the random_block_anon.thtml is like this,

PHP Formatted Code
{# begin {templatelocation} #}
{framecss}
<div class="mgPluginMI">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin:0px auto;">
    <tr>
      <td align="center" style="vertical-align:middle;">
        {media_thumbnail}
      </td>
    </tr>
    <tr>
      <td style="text-align:center;">
        <div class="pluginSmallText">{media_title}</div>
         <!--- <a href="{url_album}">{lang_browse_album}</a> --->
           {lang_browse_album}
      </td>
    </tr>
  </table>
</div>
{# end {templatelocation} #}



I wonder is having two of those files causing an issue.

I got help on showing the random photo block to anon users here

forum/viewtopic.php?showtopic=21638

Thanks,

Shane

Forum Active Member
Active Member

Group Comfort
Level:
: +3

Registered: 02/19/06
Posts: 349
Location: Dublin, Ireland

Profile Email Website  
  Quote
By: ofey (offline)  Sep 08 2009 14:58 pm  
ofey

Igarner,

Fantastic.... it works now. I forgot the random photo block uses the function phpblock_mg_randommedia_noperm which is in lib-custom.php

Once I made the changes to this everything works perfectly.

Thanks for your help, Clapping

Shane

Forum Active Member
Active Member


Group Comfort
Level:
: +3

Registered: 02/19/06
Posts: 349
Location: Dublin, Ireland

Profile Email Website  
  Quote
New Topic Post Reply


 All times are CDT. The time is now 05:08 am.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic w/ New Post Sticky Topic w/ New Post
Locked Topic w/ New Post Locked Topic w/ New Post
View Anonymous Posts 
Able to Post 
HTML Allowed 
Censored Content