Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Adsense in category thumbnails display  (Read 12920 times)

0 Members and 1 Guest are viewing this topic.

cedriclr

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Adsense in category thumbnails display
« on: January 13, 2007, 10:28:15 am »

Hello,

Is it possible to customize category thumbnails to have a google adsense ad looking like:

[Edit GauGau] Replacxed hotlinked image with attachment [/Edit]

Thanks by advance,

« Last Edit: February 05, 2008, 09:12:53 am by Joachim Müller »
Logged

lukasino

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: Adsense in category thumbnails display
« Reply #1 on: January 31, 2007, 10:14:30 am »

any solution ? but i need add code to:
[Edit GauGau] Replaced hotlinked image with attachment [/Edit]
« Last Edit: February 03, 2008, 04:07:14 pm by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Adsense in category thumbnails display
« Reply #2 on: February 01, 2007, 06:50:54 am »

Sure, edit themes/yourtheme/theme.php, find
Code: [Select]
$template_thumbnail_viewand edit as suggested below. If you don't have this section inside themes/yourtheme/theme.php, then copy
Code: [Select]
// HTML template for thumbnails display
$template_thumbnail_view = <<<EOT

<!-- BEGIN header -->
        <tr>
<!-- END header -->
<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a href="{LINK_TGT}">{THUMB}<br /></a>
                                        {CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->
<!-- BEGIN empty_cell -->
                <td valign="top" class="thumbnails" align="center">&nbsp;</td>
<!-- END empty_cell -->
<!-- BEGIN row_separator -->
        </tr>
        <tr>
<!-- END row_separator -->
<!-- BEGIN footer -->
        </tr>
<!-- END footer -->
<!-- BEGIN tabs -->
        <tr>
                <td colspan="{THUMB_COLS}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                       {TABS}
                                </tr>
                        </table>
                </td>
        </tr>
<!-- END tabs -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;
from themes/sample/theme.php into a new line before
Code: [Select]
?>into themes/yourtheme/theme.php

Next, add your adsense code into the row_separator sub-section as suggested here:
Code: [Select]
<!-- BEGIN row_separator -->
        </tr>
        <tr>
            <td colspan="<?php print $CONFIG['album_list_cols']; ?>
                <!-- your adsense code here -->
            </td>
        </tr>
        <tr>
<!-- END row_separator -->
This has been asked before afaik, that's probably why nobody has answered so far.
Logged

CloudyStryfe

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Adsense in category thumbnails display
« Reply #3 on: April 18, 2007, 02:22:00 am »

Sure, edit themes/yourtheme/theme.php...Next, add your adsense code into the row_separator sub-section as suggested here:
Code: [Select]
<!-- BEGIN row_separator -->
        </tr>
        <tr>
            <td colspan="<?php print $CONFIG['album_list_cols']; ?>
                <!-- your adsense code here -->
            </td>
        </tr>
        <tr>
<!-- END row_separator -->

I have been trying to get this to work, and keep getting the error: "Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/jcloud/public_html/artwork/themes/water_drop_copy/theme.php on line 51"

I am using a copy of the basic water drop theme. The gallery loads fine until I add in this line of the code:

Code: [Select]
<td colspan="<?php print $CONFIG['album_list_cols']; ?>
                <!-- your adsense code here -->
</td>

I don't know anything about php, and I'm still learning html... I noticed that the code goes

Code: [Select]
</tr>  <<<<This should probably be <tr>
        <tr>
            <td colspan="<?php print $CONFIG['album_list_cols']; ?>
                <!-- your adsense code here -->
            </td>
</tr>
<tr>
   <<<< This should probably be </tr>

However, when I make those changes, it still gives me the line 51 error.  :-\
« Last Edit: February 05, 2008, 09:10:39 am by Joachim Müller »
Logged

Nibbler

  • Guest
Re: Adsense in category thumbnails display
« Reply #4 on: April 18, 2007, 02:43:11 am »

Should be

Code: [Select]
<!-- BEGIN row_separator -->
        </tr>
        <tr>
            <td colspan="{$CONFIG['album_list_cols']}">
                <!-- your adsense code here -->
            </td>
        </tr>
        <tr>
<!-- END row_separator -->
Logged

CloudyStryfe

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Adsense in category thumbnails display
« Reply #5 on: April 18, 2007, 04:11:58 am »

Thanks! I can now load the page without errors.

At the moment, the ad does not seem to be centered in between the thumbnails. On my gallery there are 4 thumbnails to a row, and the Ad is positioned below the first 2. The Ad also expands the space in between the first 2 thumbnails.

It's likely due to my fault because I have modified the coppermine theme to display the gallery within a div created box. (www.cloudfanart.com/artwork) Still, I'd like to check with you guys to be see if the above code is working for someone else.

BTW in case the reader doesn't know what ad sense code looks like, mine is
Code: [Select]
<script type="text/javascript"><!--
google_ad_client = "pub-5086034948616916";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
« Last Edit: February 05, 2008, 09:11:04 am by Joachim Müller »
Logged

CloudyStryfe

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Adsense in category thumbnails display
« Reply #6 on: April 19, 2007, 02:31:26 am »

I think I might be zeroing in on the issue

When I use the code
Code: [Select]
<!-- BEGIN row_separator -->
        </tr>
        <tr>       
            <td colspan="4" align="center">
                <!-- your adsense code here -->
                My ad sense code...
            </td>           
        </tr>
        <tr>
<!-- END row_separator -->

Instead of:

Code: [Select]
<!-- BEGIN row_separator -->
        </tr>
        <tr>
            <td colspan="{$CONFIG['album_list_cols']}">
                <!-- your adsense code here -->
                my ad sense code...
            </td>
        </tr>
        <tr>
<!-- END row_separator -->


The ad is center properly. So, it seems to me that colspan="{$CONFIG['album_list_cols']}" is not communicating the "4 value" properly...
« Last Edit: February 05, 2008, 09:12:02 am by Joachim Müller »
Logged

Nibbler

  • Guest
Re: Adsense in category thumbnails display
« Reply #7 on: April 19, 2007, 01:09:18 pm »

Try the align="center" and the colspan with the variable. Otherwise post a link.
Logged

HackySack

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Adsense in category thumbnails display
« Reply #8 on: April 24, 2007, 10:51:43 am »

As this code is going into the Thumbnail page, shouldn't you be using a different variable, and not album_list_cols?

I don't know much about Coppermine (only d/l it today), but the config pages have a different value for "Number of columns on Albums page" and "Number of columns on Thumbnails page".  That would seem to indicate that there is a different value being stored.

Just my $0.02

I'd like to know if it is possible to only display the AdSense block after the 2nd row of thumbnails, and not after each row of thumbnails which is what the above code seems to do.  Have I missed a step, or is there some row count that I can test in the code?

Cheers,

Ben
Logged

Nibbler

  • Guest
Re: Adsense in category thumbnails display
« Reply #9 on: April 24, 2007, 03:11:21 pm »

You'd need to edit the function that controls the template, theme_display_thumbnails(). I can't tell you what code to use of the top of head though.
Logged

HackySack

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Adsense in category thumbnails display
« Reply #10 on: April 26, 2007, 01:08:53 am »

The ad is center properly. So, it seems to me that colspan="{$CONFIG['album_list_cols']}" is not communicating the "4 value" properly...

Try
Code: [Select]
{$CONFIG['thumbcols']} instead.

Cheers,

Ben
Logged

HackySack

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Adsense in category thumbnails display
« Reply #11 on: April 26, 2007, 02:23:55 am »

You'd need to edit the function that controls the template, theme_display_thumbnails(). I can't tell you what code to use of the top of head though.

OK, so I've learned a bit of PHP and hacked the theme.inc.php file some, and this is what I've come up with.

Find the theme_display_thumbnails function in theme.inc.php, and change the following line:

Code: [Select]
        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo $row_separator;
        }

to something like:

Code: [Select]
        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {

                 //change the album id ($aid) to an integer, so we can ignore the randomlist & lastupdated lists
    $aidexpand = (int) $aid;

                 //change the 1 below to the row number under which you would like the Google code to appear
    if (($i == (1 * $thumbcols)) && ($aidexpand > 0))  {
echo '</tr><tr><td colspan='. $thumbcols . ' align=center><!-- your adsense code here -->This is a test</td></tr>';
    } else {
echo $row_separator;
    }
        }

I would like to have included the Google code in the theme.php file, but I couldn't figure out how to add my own code block (ie instead of row_separator, have the template add the row_separator_google) so the google stuff has to live in the theme.inc.php for now.

Feel free to suggest improvements to my PHP, as this is the first time I've touched the language.

Cheers,

Ben
Logged

HackySack

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Adsense in category thumbnails display
« Reply #12 on: April 26, 2007, 02:47:41 am »

OK, figured out how to add a custom block to the template and also that I can put the hacked function in the theme.php instead of changing the theme.inc.php.   ;D

First, added this to the theme.php under the existing row_separator block:

Code: [Select]
<!-- BEGIN row_separator_google -->
        </tr>
        <tr>
            <td colspan="{$CONFIG['thumbcols']}" align=center>
                <!-- your adsense code here -->This is a test
            </td>
        </tr>
        <tr>
<!-- END row_separator_google -->

Then changed the theme_display_thumbnails function to read that block from the theme template (add this under the existing "$row_separator = ..." assignment):

Code: [Select]
$row_separator_google = template_extract_block($template_thumbnail_view, 'row_separator_google');
and finally, add the echo to the custom if statement lower in the function:

Code: [Select]
        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
    $aidexpand = (int) $aid;
    if (($i == (1 * $thumbcols)) && ($aidexpand > 0))  {
echo $row_separator_google;
    } else {
echo $row_separator;
    }
        }

Below is the entire theme.php, so you can copy if desired:

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.10
  $Source$
  $Revision: 3275 $
  $Author: gaugau $
  $Date: 2006-09-03 12:10:47 +0200 (So, 03 Sep 2006) $
**********************************************/

define('THEME_IS_XHTML10_TRANSITIONAL',1); // Remove this if you edit this template until
                                           // you have validated it. See docs/theme.htm.

// HTML template for template sys_menu spacer
$template_sys_menu_spacer ='<img src="themes/water_drop/images/orange_carret.gif" width="8" height="8" border="0" alt="" />';

$template_thumbnail_view = <<<EOT

<!-- BEGIN header -->
        <tr>
<!-- END header -->
<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a href="{LINK_TGT}">{THUMB}<br /></a>
                                        {CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->
<!-- BEGIN empty_cell -->
                <td valign="top" class="thumbnails" align="center">&nbsp;</td>
<!-- END empty_cell -->
<!-- BEGIN row_separator -->
        </tr>
        <tr>
<!-- END row_separator -->
<!-- BEGIN row_separator_google -->
        </tr>
        <tr>
            <td colspan="
{$CONFIG['thumbcols']}" align=center>
                <!-- your adsense code here -->This is a test
            </td>
        </tr>
        <tr>
<!-- END row_separator_google -->
<!-- BEGIN footer -->
        </tr>
<!-- END footer -->
<!-- BEGIN tabs -->
        <tr>
                <td colspan="{THUMB_COLS}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>
                                       {TABS}
                                </tr>
                        </table>
                </td>
        </tr>
<!-- END tabs -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->
EOT;

function 
theme_display_thumbnails(&$thumb_list$nbThumb$album_name$aid$cat$page$total_pages$sort_options$display_tabs$mode 'thumb')
{
    global 
$CONFIG;
    global 
$template_thumb_view_title_row,$template_fav_thumb_view_title_row$lang_thumb_view$template_tab_display$template_thumbnail_view$lang_album_list;

    static 
$header '';
    static 
$thumb_cell '';
    static 
$empty_cell '';
    static 
$row_separator '';
    static 
$row_separator_google '';
    static 
$footer '';
    static 
$tabs '';
    static 
$spacer '';

    if (
$header == '') {
        
$thumb_cell template_extract_block($template_thumbnail_view'thumb_cell');
        
$tabs template_extract_block($template_thumbnail_view'tabs');
        
$header template_extract_block($template_thumbnail_view'header');
        
$empty_cell template_extract_block($template_thumbnail_view'empty_cell');
        
$row_separator template_extract_block($template_thumbnail_view'row_separator');
$row_separator_google template_extract_block($template_thumbnail_view'row_separator_google');
        
$footer template_extract_block($template_thumbnail_view'footer');
        
$spacer template_extract_block($template_thumbnail_view'spacer');
    }

    
$cat_link is_numeric($aid) ? '' '&amp;cat=' $cat;
    
$uid_link = (isset($_GET['uid']) && is_numeric($_GET['uid'])) ? '&amp;uid=' $_GET['uid'] : '';

    
$theme_thumb_tab_tmpl $template_tab_display;

    if (
$mode == 'thumb') {
        
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
        
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' $aid $cat_link $uid_link '&amp;page=%d'));
        
$theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' $aid $cat_link $uid_link '&amp;page=%d'));
        
$theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' $aid $cat_link $uid_link '&amp;page=%d'));
    } else {
        
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' $cat '&amp;page=%d'));
        
$theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' $cat '&amp;page=%d'));
        
$theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' $cat '&amp;page=%d'));
    }

    
$thumbcols $CONFIG['thumbcols'];
    
$cell_width ceil(100 $CONFIG['thumbcols']) . '%';

    
$tabs_html $display_tabs create_tabs($nbThumb$page$total_pages$theme_thumb_tab_tmpl) : '';
    
// The sort order options are not available for meta albums
    
if ($sort_options) {
        
$param = array('{ALBUM_NAME}' => $album_name,
            
'{AID}' => $aid,
            
'{PAGE}' => $page,
            
'{NAME}' => $lang_thumb_view['name'],
            
'{TITLE}' => $lang_thumb_view['title'],
            
'{DATE}' => $lang_thumb_view['date'],
            
'{SORT_TA}' => $lang_thumb_view['sort_ta'],
            
'{SORT_TD}' => $lang_thumb_view['sort_td'],
            
'{SORT_NA}' => $lang_thumb_view['sort_na'],
            
'{SORT_ND}' => $lang_thumb_view['sort_nd'],
            
'{SORT_DA}' => $lang_thumb_view['sort_da'],
            
'{SORT_DD}' => $lang_thumb_view['sort_dd'],
            
'{POSITION}' => $lang_thumb_view['position'],
            
'{SORT_PA}' => $lang_thumb_view['sort_pa'],
            
'{SORT_PD}' => $lang_thumb_view['sort_pd'],
            );
        
$title template_eval($template_thumb_view_title_row$param);
    } else if (
$aid == 'favpics' && $CONFIG['enable_zipdownload'] == 1) { //Lots of stuff can be added here later
       
$param = array('{ALBUM_NAME}' => $album_name,
                             
'{DOWNLOAD_ZIP}'=>$lang_thumb_view['download_zip']
                               );
       
$title template_eval($template_fav_thumb_view_title_row$param);
    }else{
        
$title $album_name;
    }


    if (
$mode == 'thumb') {
        
starttable('100%'$title$thumbcols);
    } else {
        
starttable('100%');
    }

    echo 
$header;

    
$i 0;
    foreach(
$thumb_list as $thumb) {
        
$i++;
        if (
$mode == 'thumb') {
            if (
$aid == 'lastalb') {
                
$params = array('{CELL_WIDTH}' => $cell_width,
                    
'{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
                    
'{THUMB}' => $thumb['image'],
                    
'{CAPTION}' => $thumb['caption'],
                    
'{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            } else {
                
$params = array('{CELL_WIDTH}' => $cell_width,
                    
'{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&amp;pos={$thumb['pos']}$uid_link",
                    
'{THUMB}' => $thumb['image'],
                    
'{CAPTION}' => $thumb['caption'],
                    
'{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            }
        } else {
            
$params = array('{CELL_WIDTH}' => $cell_width,
                
'{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                
'{THUMB}' => $thumb['image'],
                
'{CAPTION}' => $thumb['caption'],
                
'{ADMIN_MENU}' => ''
                
);
        }
        echo 
template_eval($thumb_cell$params);

        if (((
$i $thumbcols) == 0) && ($i count($thumb_list))) {
    $aidexpand = (int) $aid;
    if (($i == ($thumbcols)) && ($aidexpand 0))  {
echo $row_separator_google;
    } else {
echo $row_separator;
    }
        }
    }
    for (;(
$i $thumbcols); $i++) {
        echo 
$empty_cell;
    }
    echo 
$footer;

    if (
$display_tabs) {
        
$params = array('{THUMB_COLS}' => $thumbcols,
            
'{TABS}' => $tabs_html
            
);
        echo 
template_eval($tabs$params);
    }

    
endtable();
    echo 
$spacer;
}

?>

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Adsense in category thumbnails display
« Reply #13 on: April 26, 2007, 06:35:11 am »

Find the theme_display_thumbnails function in theme.inc.php, and change the following line:
Never edit include/themes.inc.php! Edit themes/yourtheme/themep.php instead!
Logged

niks_007

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 73
Re: Adsense in category thumbnails display
« Reply #14 on: July 16, 2007, 09:02:37 pm »

hi...
 i searched the forum and find what similer i want. but this shows only one ad between 3 rows in between 1 and 2 but not between 2 and three it should show ad after each row i know this can be done with slight changes. i tried but didn's sucessed please help me out.


Nishant
Logged

Nibbler

  • Guest
Re: Adsense in category thumbnails display
« Reply #15 on: July 16, 2007, 09:12:47 pm »

Modify only $template_thumbnail_view and don't change any functions.
Logged

niks_007

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 73
Re: Adsense in category thumbnails display
« Reply #16 on: July 16, 2007, 09:19:09 pm »

Sir,
         I need more specifc help i tried but wasn't suceceed. please let me know by example if possible.

Thanks in advance.
Nishant
Logged

Nibbler

  • Guest
Re: Adsense in category thumbnails display
« Reply #17 on: July 16, 2007, 09:38:57 pm »

Just change the row_separator section to this:

Code: [Select]
<!-- BEGIN row_separator -->
        </tr>
        <tr>
            <td colspan="{$CONFIG['thumbcols']}">
                <!-- your adsense code here -->
            </td>
        </tr>
        <tr>
<!-- END row_separator -->
Logged

niks_007

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 73
Re: Adsense in category thumbnails display
« Reply #18 on: July 19, 2007, 12:31:20 am »

hi...
      i made necessory changes and now it shows ads in between all rows. woring perfectly fine.
copy and use the code if any one need that.

Thanks
Nishant

Code: [Select]
$template_thumbnail_view = <<<EOT

<!-- BEGIN header -->
        <tr>
<!-- END header -->
<!-- BEGIN thumb_cell -->
        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">
                <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td align="center">
                                        <a href="{LINK_TGT}">{THUMB}<br /></a>
                                        {CAPTION}
                                        {ADMIN_MENU}
                                </td>
                        </tr>
                </table>
        </td>
<!-- END thumb_cell -->
<!-- BEGIN empty_cell -->
                <td valign="top" class="thumbnails" align="center">&nbsp;</td>
<!-- END empty_cell -->
<!-- BEGIN row_separator -->
        </tr>

        <tr>
<!-- END row_separator -->
<!-- BEGIN row_separator_google -->
        </tr>
        <tr>
            <td colspan="{$CONFIG['thumbcols']}" align=center class="thumbnails">
                <!-- your adsense code here -->

                   
             
            </td>
        </tr>
        <tr>
<!-- END row_separator_google -->
<!-- BEGIN footer -->
        </tr>
<!-- END footer -->
<!-- BEGIN tabs -->
        <tr>
                <td colspan="{THUMB_COLS}" style="padding: 0px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                                <tr>

                   
                                       {TABS}
                                </tr>
                        </table>
                </td>
        </tr>
<!-- END tabs -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->
EOT;

function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb')
{
    global $CONFIG;
    global $template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $template_tab_display, $template_thumbnail_view, $lang_album_list;

    static $header = '';
    static $thumb_cell = '';
    static $empty_cell = '';
    static $row_separator = '';
    static $row_separator_google = '';
    static $footer = '';
    static $tabs = '';
    static $spacer = '';

    if ($header == '') {
        $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
        $tabs = template_extract_block($template_thumbnail_view, 'tabs');
        $header = template_extract_block($template_thumbnail_view, 'header');
        $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
        $row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
$row_separator_google = template_extract_block($template_thumbnail_view, 'row_separator_google');
        $footer = template_extract_block($template_thumbnail_view, 'footer');
        $spacer = template_extract_block($template_thumbnail_view, 'spacer');
    }

    $cat_link = is_numeric($aid) ? '' : '&amp;cat=' . $cat;
    $uid_link = (isset($_GET['uid']) && is_numeric($_GET['uid'])) ? '&amp;uid=' . $_GET['uid'] : '';

    $theme_thumb_tab_tmpl = $template_tab_display;

    if ($mode == 'thumb') {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $uid_link . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $uid_link . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $uid_link . '&amp;page=%d'));
    } else {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
    }

    $thumbcols = $CONFIG['thumbcols'];
    $cell_width = ceil(100 / $CONFIG['thumbcols']) . '%';

    $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
    // The sort order options are not available for meta albums
    if ($sort_options) {
        $param = array('{ALBUM_NAME}' => $album_name,
            '{AID}' => $aid,
            '{PAGE}' => $page,
            '{NAME}' => $lang_thumb_view['name'],
            '{TITLE}' => $lang_thumb_view['title'],
            '{DATE}' => $lang_thumb_view['date'],
            '{SORT_TA}' => $lang_thumb_view['sort_ta'],
            '{SORT_TD}' => $lang_thumb_view['sort_td'],
            '{SORT_NA}' => $lang_thumb_view['sort_na'],
            '{SORT_ND}' => $lang_thumb_view['sort_nd'],
            '{SORT_DA}' => $lang_thumb_view['sort_da'],
            '{SORT_DD}' => $lang_thumb_view['sort_dd'],
            '{POSITION}' => $lang_thumb_view['position'],
            '{SORT_PA}' => $lang_thumb_view['sort_pa'],
            '{SORT_PD}' => $lang_thumb_view['sort_pd'],
            );
        $title = template_eval($template_thumb_view_title_row, $param);
    } else if ($aid == 'favpics' && $CONFIG['enable_zipdownload'] == 1) { //Lots of stuff can be added here later
       $param = array('{ALBUM_NAME}' => $album_name,
                             '{DOWNLOAD_ZIP}'=>$lang_thumb_view['download_zip']
                               );
       $title = template_eval($template_fav_thumb_view_title_row, $param);
    }else{
        $title = $album_name;
    }


    if ($mode == 'thumb') {
        starttable('100%', $title, $thumbcols);
    } else {
        starttable('100%');
    }

    echo $header;

    $i = 0;
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if ($aid == 'lastalb') {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            } else {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&amp;pos={$thumb['pos']}$uid_link",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            }
        } else {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => ''
                );
        }
        echo template_eval($thumb_cell, $params);

        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
    $aidexpand = (int) $aid;
    if (($i == (1 * $thumbcols)) && ($aidexpand > 0))  {
echo $row_separator_google;
    } else {
echo $row_separator_google;
    }
        }
    }
    for (;($i % $thumbcols); $i++) {
        echo $empty_cell;
    }
    echo $footer;

    if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols,
            '{TABS}' => $tabs_html
            );
        echo template_eval($tabs, $params);
    }

    endtable();
    echo $spacer;
}

Logged

iorkara

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
  • Be Nice.
    • High Resolution Wallpapers
Re: Adsense in category thumbnails display
« Reply #19 on: February 04, 2008, 03:20:40 pm »

Thanks for this Great Thread guys. Very helpful.
Logged
Pages: [1]   Go Up
 

Page created in 0.032 seconds with 20 queries.