forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Muurvaren on September 09, 2006, 12:11:55 pm

Title: Changing the value of $counter_text
Post by: Muurvaren on September 09, 2006, 12:11:55 pm
Hi there!

I’ am trying to integrate an external counter (BBclone) in thumpnails.php in order to know what album is liked most by visitors.
This is working but the value of $counter_text is represented by the album number. I want the _name_ of the album instead.

The number is displayed by: $counter_text = $album;

I tried everything but no go...  ???
I searched this board and also the forum of BBClone but it didn't solve my problem (although several users are using BBclone the same way i want to...).

Anyone to help me out?

My site is at: http://www.muurvaren.nl/

Title: Re: Changing the value of $counter_text
Post by: Nibbler on September 09, 2006, 12:30:55 pm
Post your code.
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 09, 2006, 02:32:16 pm
Post your code.

   $counter_text = $album;
   define("_BBC_PAGE_NAME", $counter_text);
   define("_BBCLONE_DIR", "bbclone/");
   define("COUNTER", _BBCLONE_DIR."mark_page.php");
   if (is_readable(COUNTER)) include_once(COUNTER);

The code is inserted at the end of thumbnails.php

Title: Re: Changing the value of $counter_text
Post by: Sami on September 09, 2006, 04:17:39 pm
Try this:
   $counter_text = $CURRENT_ALBUM_DATA['title'];
Title: Re: Changing the value of $counter_text
Post by: Joachim Müller on September 09, 2006, 07:33:25 pm
Related thread: Intergrate BBClone into cpg142  (http://forum.coppermine-gallery.net/index.php?topic=24937.0)
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 09, 2006, 07:58:33 pm
Try this:
   $counter_text = $CURRENT_ALBUM_DATA['title'];

Already tried that one, no success  :(

Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 09, 2006, 08:06:32 pm
Related thread: Intergrate BBClone into cpg142  (http://forum.coppermine-gallery.net/index.php?topic=24937.0)

No, this one (witch I already found myself) does not work either. It's an easy question (Changing the numeric value of the album to the actual name of the album) but the answer seems to be rather difficult...

Title: Re: Changing the value of $counter_text
Post by: Nibbler on September 09, 2006, 08:19:19 pm
This would be the simplest way without looking into the code in detail.

Code: [Select]
if (is_numeric($album)){
$sql = "SELECT title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = $album";
$result = cpg_db_query($sql);
list($album) = mysql_fetch_row($result);
}

$counter_text = $album;
define("_BBC_PAGE_NAME", $counter_text);
define("_BBCLONE_DIR", "bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);

Should go just before pagefooter()
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 09, 2006, 08:52:34 pm
This would be the simplest way without looking into the code in detail.

Code: [Select]
if (is_numeric($album)){
$sql = "SELECT title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = $album";
list($album) = mysql_fetch_row($result);
}

$counter_text = $album;
define("_BBC_PAGE_NAME", $counter_text);
define("_BBCLONE_DIR", "bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);

Should go just before pagefooter()

Thanks for the effort Nibbler, but no go... (it returns nothing)

http://www.muurvaren.nl/bbclone/show_detailed.php?lng=nl


Title: Re: Changing the value of $counter_text
Post by: Nibbler on September 09, 2006, 09:01:03 pm
I missed out the most important part of the code, that's why. I edited it into my post so try again with the new code.
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 09, 2006, 09:12:45 pm
I missed out the most important part of the code, that's why. I edited it into my post so try again with the new code.

Nop...  ???

Title: Re: Changing the value of $counter_text
Post by: Nibbler on September 09, 2006, 09:17:27 pm
So you have this code at the end of thumbnails.php and it doesn't work ?

Code: [Select]
$META_ALBUM_SET = $ALBUM_SET; //temporary assignment until we are sure we are keeping the $META_ALBUM_SET functionality.
CPGPluginAPI::filter('post_breadcrumb',null);
if (!$valid) {
    form_albpw();
} else {
    display_thumbnails($album, (isset($cat) ? $cat : 0), $page, $CONFIG['thumbcols'], $CONFIG['thumbrows'], true);
}

if (is_numeric($album)){
$sql = "SELECT title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = $album";
$result = cpg_db_query($sql);
list($album) = mysql_fetch_row($result);
}

$counter_text = $album;
define("_BBC_PAGE_NAME", $counter_text);
define("_BBCLONE_DIR", "bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);

pagefooter();
ob_end_flush();

?>
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 09, 2006, 09:24:00 pm
So you have this code at the end of thumbnails.php and it doesn't work ?

Code: [Select]
$META_ALBUM_SET = $ALBUM_SET; //temporary assignment until we are sure we are keeping the $META_ALBUM_SET functionality.
CPGPluginAPI::filter('post_breadcrumb',null);
if (!$valid) {
    form_albpw();
} else {
    display_thumbnails($album, (isset($cat) ? $cat : 0), $page, $CONFIG['thumbcols'], $CONFIG['thumbrows'], true);
}

if (is_numeric($album)){
$sql = "SELECT title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = $album";
$result = cpg_db_query($sql);
list($album) = mysql_fetch_row($result);
}

$counter_text = $album;
define("_BBC_PAGE_NAME", $counter_text);
define("_BBCLONE_DIR", "bbclone/");
define("COUNTER", _BBCLONE_DIR."mark_page.php");
if (is_readable(COUNTER)) include_once(COUNTER);

pagefooter();
ob_end_flush();

?>

No it returns 'Main Site'...

You can see it your self:
http://www.muurvaren.nl/bbclone/show_detailed.php?lng=en

Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 09, 2006, 10:05:53 pm
So you have this code at the end of thumbnails.php and it doesn't work ?

Hi Nibbler,

Had to remove the code because it showed the thumbnails twice on the same page...  ;D

Title: Re: Changing the value of $counter_text
Post by: Nibbler on September 09, 2006, 10:07:31 pm
Post the complete file, you probably have added the code all wrong.
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 10, 2006, 12:26:35 am
Post the complete file, you probably have added the code all wrong.

Here it is...
Title: Re: Changing the value of $counter_text
Post by: Nibbler on September 10, 2006, 12:47:37 pm
Add the code I posted.
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 10, 2006, 01:32:41 pm
Add the code I posted.

To be sure I upgraded to 1.4.9 (from 1.4.8 )

Title: Re: Changing the value of $counter_text
Post by: Nibbler on September 10, 2006, 01:47:48 pm
That a 1.4.8 file and is incomplete.
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 10, 2006, 03:36:25 pm
That a 1.4.8 file and is incomplete.

My mistake, sorry!

Attaches is the 1.4.9 version of thumpnails.php





Title: Re: Changing the value of $counter_text
Post by: mainpower on September 11, 2006, 09:25:54 pm
I am really looking forward to this but would it be usable for other than thumpnails as well ???
More like a footer ...

Title: Re: Changing the value of $counter_text
Post by: Nibbler on September 11, 2006, 09:26:43 pm
File is incomplete. See for yourself.
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 12, 2006, 08:20:43 pm
File is incomplete. See for yourself.

I did check, what is missing in you’re opinion?  I compared my file with the thumnails.php from CPG 1.4.9 and see no difference accept you’re additional code...  ???

Title: Re: Changing the value of $counter_text
Post by: Nibbler on September 12, 2006, 09:24:25 pm
It ends in the middle of a word.

Code: [Select]
if (is_numeric($album)){

$sql = "SELECT title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = $album";

$result = cpg_db_query($sql);

list($album) = mysql_fetch_r
Title: Re: Changing the value of $counter_text
Post by: Muurvaren on September 12, 2006, 09:45:39 pm
It ends in the middle of a word.

Code: [Select]
if (is_numeric($album)){
    $sql = "SELECT title FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = $album";
    $result = cpg_db_query($sql);
    list($album) = mysql_fetch_r

I just downloaded my earlier submitted file and (double) checked, its complete!

As the one on my website.