Tag cloud from keywords Tag cloud from keywords
 

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]

Main Menu

Tag cloud from keywords

Started by Aditya Mooley, December 20, 2005, 07:55:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Aditya Mooley

Here's a simple hack displaying keywords as tag cloud on search page.
Tag cloud is the weighted list of keywords.
See it in action here: http://nagpurbirds.org/search.php

Download the attached file rename it as keyword.inc.php and replace it with your include/keyword.inc.php (Don't forget to take a backup first). If there is already any mod applied on this file you will have to merge the changes in this file manually.

Aditya

[Edit Joachim 2009-11-19]
The instructions for this mod are no longer applicable. Please do not replace your file with the one in the attachment as Aditya originally posted. Instead, please read the instructions in http://forum.coppermine-gallery.net/index.php/topic,25311.msg310637.html#msg310637
[/Edit]
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

ratajczak

I am missing the attachment....

Have a nice day,

Oliver

ratajczak

Seems to fine fine... but.. my keywords are there several times... Please have a look at www.36zu9.de

Thanks in advacne,

Oliver

Aditya Mooley

Was the keyword list working properly before adding this mod?
Attach your file here, so that I can check it for errors.

Aditya
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

ratajczak

#4
It seem to be that I have made erros while entering my keywords .. I wll try to fix it... thanks a lot in advance...

It didn't work also.. the keywords are more then ones in the list...

I will attach my the keyword.inc.php (changed to .txt) file I am using....

DO you have an idea?

Thanks a lot in advance,

Oliver

sigepjedi

How can you limit it to only returning... say keywords with atleast 10 searches or something like that?

Aditya Mooley

Quote from: sigepjedi on December 22, 2005, 08:11:12 PM
How can you limit it to only returning... say keywords with atleast 10 searches or something like that?

It is not possible to limit it that way, since we are not keeping the data of what was searched by users in past.
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

Aditya Mooley

Quote from: ratajczak on December 22, 2005, 09:52:05 AM
It didn't work also.. the keywords are more then ones in the list...
I will attach my the keyword.inc.php (changed to .txt) file I am using....
DO you have an idea?

Your files looks ok to me and this file is working fine on my local setup and the URL I have specified in the first post, so the only problem can be the way in which the keywords are defined in your setup.

Put your original file and see whether the keywords are still duplicated. If so, then you need to correct the keywords.

Aditya
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

sigepjedi

More specificly, I am asking how to limit the results but the count of the searches.

For instance, the searches are selected... Then you Sort the keywords by the count. Here I want to them limit the Displayed keywords to words with only x amount of counted searches.

Does this make sense?

tmselim

I'm having an issue similar to what was mentioned above... when I run the code as-is, my keywords all appear as the same size and multiple occurances  of the same keyword appear mutliple time.  Since this wasn't happening in the past, I compared the code between the original file and this one and found that the code to create a unique array was different.  However, if I correct that problem, then the tag cloud still doesn't work since the resulting keywords_array only contains a unique list (so the weighing is the same).

Am I missing something?  Have you revised this code?

(I've attached my version)

Aditya Mooley

Hmmm...

I have downloaded your file. Need to look at your as well as my file. Will upload the new file if some bug is found.
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

Aditya Mooley

Fixed the bug in my file and updated the attachement in first post.

Please download and let me know whether it works.

Thanks
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

tifster

I installed 1.4.4 so I could install this mod, but then while testing it, I had problems when I clicked on a keyword.  Sometimes, not all the time, I got a critical error while accessing the database.  I tracked this down to the search string not getting copied properly and therefore the query wasn't built right.  I'm not sure who this might effect:  everybody with 1.4.4, everybody with this mod, or maybe just people with my specific version of PHP (4.3.10-16).  Anyway, here's a patch:

*** thumbnails.php.old  Sat Mar 25 01:42:07 2006
--- thumbnails.php.new  Sat Mar 25 01:41:57 2006
***************
*** 92,97 ****
--- 92,98 ----
          $album = 'search';
  }
  if (isset($_GET['search'])) {
+     $USER['search'] = array();
      $USER['search']['search'] = $_GET['search'];
  }


BTW, I'm loving the new tagging (aka keywords) and the tag cloud.  Thanks guys.

smcasey

I'm also getting double keyword on version 1.4.5 of coppermine.  I replaced the file with the orginal and the keywords look fine.  It looks like when I have 2 pictures in a album I get double keyword listings.

Thanks,
S

Aditya Mooley

--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

smcasey


Aditya Mooley

Ok. Got the problem. Two solutions to solve this. See which one you want to use.

1. All the keywords will be displayed in small case on search.php (this won't effect the search though)

Find
Quote
$keywords_array[] = $word;

Replace with:
Quote
$keywords_array[] = strtolower($word);


2. The keywords will be displayed in the case as you have entered. BUT the drawback is, if you have 2 keywords with same name but different case they will be treated as separate keywords.

Find:
Quote
if (!in_array(strtolower($word),$keywords_array)) {

And Replace with:
Quote
if (!in_array($word,$keywords_array)) {

I will suggest 1st solution as it will give you better results.

Aditya
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

smcasey

Aditya,
Thanks, that looks like it fixed it.  I have to upload some more photos to see the tag cloud work better.  :)

coopersita

Is there a way to have the tag cloud in the main page instead of the search page?