By: ofey (offline)  Sep 06 2009 09:02 am (Read 2170 times)  

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

ofey




Group Comfort
Level:
: +3
Registered:: 02/19/06

Posts: 349
By: Manny (offline)  Sep 06 2009 17:10 pm  

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.

Manny



Group Comfort
Level:
: +5
Registered:: 03/07/08

Posts: 102
By: Mark (offline)  Sep 06 2009 18:06 pm  

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


glFusion - Enhanced Content Management

Mark



Group Comfort
Level:
: +112
Registered:: 10/21/05

Posts: 6445
By: ofey (offline)  Sep 07 2009 02:36 am  

Mark,

I thought it was something like that alright.

I have a go at it later.

Thanks,

Shane

ofey



Group Comfort
Level:
: +3
Registered:: 02/19/06

Posts: 349
By: ofey (offline)  Sep 07 2009 10:15 am  

Mark,

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

Thanks,

Shane

ofey




Group Comfort
Level:
: +3
Registered:: 02/19/06

Posts: 349
By: lgarner (offline)  Sep 07 2009 14:00 pm  

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.

lgarner



Group Comfort
Level:
: +52
Registered:: 06/10/08

Posts: 1948
By: ofey (offline)  Sep 07 2009 16:42 pm  

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

ofey



Group Comfort
Level:
: +3
Registered:: 02/19/06

Posts: 349
By: ofey (offline)  Sep 07 2009 16:45 pm  

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

ofey




Group Comfort
Level:
: +3
Registered:: 02/19/06

Posts: 349
By: lgarner (offline)  Sep 07 2009 19:36 pm  

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.

lgarner



Group Comfort
Level:
: +52
Registered:: 06/10/08

Posts: 1948
By: ofey (offline)  Sep 08 2009 05:17 am  

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

ofey




Group Comfort
Level:
: +3
Registered:: 02/19/06

Posts: 349
By: ofey (offline)  Sep 08 2009 05:32 am  

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

http://www.glfusion.org/forum/viewtopic.php?showtopic=21638

Thanks,

Shane

ofey



Group Comfort
Level:
: +3
Registered:: 02/19/06

Posts: 349
By: ofey (offline)  Sep 08 2009 14:58 pm  

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

ofey




Group Comfort
Level:
: +3
Registered:: 02/19/06

Posts: 349
12 posts :: Page 1 of 1
All times are CDT. The time is now 01:18 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