forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Searching => Topic started by: Aditya Mooley on December 20, 2005, 07:55:12 am
-
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 (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]
-
I am missing the attachment....
Have a nice day,
Oliver
-
Seems to fine fine... but.. my keywords are there several times... Please have a look at www.36zu9.de
Thanks in advacne,
Oliver
-
Was the keyword list working properly before adding this mod?
Attach your file here, so that I can check it for errors.
Aditya
-
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
-
How can you limit it to only returning... say keywords with atleast 10 searches or something like that?
-
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.
-
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
-
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?
-
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)
-
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.
-
Fixed the bug in my file and updated the attachement in first post.
Please download and let me know whether it works.
Thanks
-
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.
-
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
-
URL please.
-
Here is my development site: http://www.travelscraps.com/cpg/search.php
Thanks for the help. :)
-
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
$keywords_array[] = $word;
Replace with:
$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:
if (!in_array(strtolower($word),$keywords_array)) {
And Replace with:
if (!in_array($word,$keywords_array)) {
I will suggest 1st solution as it will give you better results.
Aditya
-
Aditya,
Thanks, that looks like it fixed it. I have to upload some more photos to see the tag cloud work better. :)
-
Is there a way to have the tag cloud in the main page instead of the search page?
-
Thank you
Is very usefull
regards from Spain
-
Hi,
It's a great piece of code. Thank you so much !
Just wondering - how do you change the fonts to Arial and a larger size ?
pse advise.
thank you.
-
I am not changing fonts anywhere. Just the size of the keywords are changed according to their weight.
Here's the code in search.inc.php which does this
if ($em > 24) {
$span = 'font-size: 24px; font-weight: bold;';
} else {
$span = "font-size: {$em}px;";
}
-
Thanks - I forgot the size of the words are weighted.
Anyway, it's a great piece of very useful code.
thank you again !! :) :)
-
Hi,
I seem to have this problem - when I click on a keyword, the page comes up but it says there are no images to display.
can this be?
pse advice.
thanks.
-
Link to your site please.
-
here's the link:
http://www.photograffs.com/nkeywordlink.php
thanks.
-
I searched for few keywords like holland, orchestra and niagara_falls. They returned 11, 1 and 1 results respectively.
-
hi,
can you try cameron_highlands, toa_payoh and hong_kong.
turns up blanks - no images.
-
Hi again,
my sincere apologies.
it works - after I deleted the temporary files.
so sorry.
-
Is there a way to put the tag cloud in the sidebar?
-
No. Someone will have to modify the script to work for sidebar.
-
I've been looking into improving my keyword search so your mod is great, thank you. I believe I have followed your instructions fully (download file, rename and upload) and it is working in some ways, but I don't think it is quite the expected results, because I have some words repeated several times e.g. Bite over 60 times and then it starts the alphabet again and works fine.
http://www.darktea.co.uk/search.php
I know the keywords were listed fine before this trying this mod, because I was checking them this morning.
Any help would be wonderful, thanks.
-
Looks very odd. I hope you have a backup of original script. Please rename the modified script and revert to the original script. I will look into this problem ASAP. If possible PM me the FTP details of your site so that I can debug the script.
-
I have a backup of the site so I can replace the file, but haven't got round to it yet. I will PM you with the details, thank you for the offer.
-
hey ia dded the php file to my coppermine, replaced the old file and everything but it doesnt seem to be making any clod tag = /
any suggestions?
thanks!
-
Give the link to your site.
-
http://www.paramorefans.com/photos/
thanks for taking ur time!
-
sorry for double posting....
this could help SEO right?
-
I can't even see the normal list of keywords on your search page. Was it working previously? Have you enabled the " Enable clickable keywords in search" option from config?
-
yes the keyword funtion is enabled
and I just installed it so i cant say it worked before
-
First check the standard keyword list using the original search.inc.php file. If you can see keyword list on search page then we can go ahead and debug the modifications for tag cloud.
-
how do i do that = /
-
Restore the original search.inc.php and then go to search page and check whether the keywords are shown below the search form. If not then there is some other problem.
I hope you have already assigned keywords to photos.
-
sorry for not following this
i replaced the orifinal file but i still dont have any keywords in the search menu
-
There's an option in config to enable clickable keyword search. See to it that you have done this.
-
I can't seem to get this to work. I did manage to get 1 word to get larger, but I still have many duplicates, and some words where I know there are multiple instances are not showing larger.
One theory is that the words that are displayed are the result of searching description and title, and not just keyword. This may or may not have anything to do with it. I still have a lot of tagging to do once I know this works. I've tried to edit or delete duplicates but cannot.
My original keyword.inc works fine. Any help would be appreciated.
http://www.elesman.com/photos/
-
I will check these files with my local setup and let you know if any modifications are needed to it.
-
thanks very much. I have made some progress and think my problem is with the keywords that I have previously entered. I can edit them and it seems to fix most of them.
Additional question: what are the rules for the word sizes and styles: ie: 10 results=12px;25 results=13px; 50 results=20px bold; etc....and where are they defined?
I plan on creating a mod so i can add this tag cloud to my index page. will let you know...might be over my head...no pun intended...
-
I was able to cobble together a hack that adds the keyword cloud to the index.
Simple add this few lines of code to the anycontent.php file just before the endtable();
if ($CONFIG['clickable_keyword_search'] != 0) {
include('include/keyword.inc.php');
}
need to make some html tweeks but it seems to work fine.
-
The font size is decided by following line
$em = ($keyword_count[$keywords_array[$i]] < 6) ? 12 : (12 + (int)(($keyword_count[$keywords_array[$i]] - 5) / 5)) * 2;
The max font size is limited to 24, so if the value of $em exceeds this value, it is changed to 24 in the line following.
-
Hello I new here..
I have also the problem with duplicate words!
I want display the word larger, when it has more results, and not mutiple..
What I make false?
please help..
and sry for my english =)
thx
-
Those who had this problem of duplicates edited their keywords and everything worked fine thereafter.
-
SUPERB!! thanks aditya
-
Where can we find the search file for the tag clouds?
Thanks in advance!
-
Didn't you read the first post?
-
Is there a way of show popular search results in a cloud, like the keyword cloud
Thanks ;D
-
Nopes. Coppermine doesn't save user search terms anywhere. So there is no way to show them as a cloud.
-
Hi, I have also treid to install you hack but it didnt make a change.
http://www.bollybilder.de/search.php
Also its not so cool when some words are displayed twice or more. Hope you can help me, thx.
-
Those who had this problem of duplicates edited their keywords and everything worked fine thereafter.
-
Ok but why are my links looking als the same? There are no clowds, they look just the same.
-
Hy everyone! ;D
I was wondering if there is a way to display only keywords that have for example 5 photos referring.
My problem is I have hundred of keywords and displaying all slows down quite a bit the page.
Would it be possible to limit clickable keywords only to the ones that refeer to -for example - 5 photos??? ???
Thanks to anyone who can give me a clue .... :-\
-
Ok but why are my links looking als the same? There are no clowds, they look just the same.
IMO, there is some problem of spaces which causes this. If if edit your keywords properly it should work. This is what others who have used this have reported. I personally never had this problem on my setup.
-
Would it be possible to limit clickable keywords only to the ones that refeer to -for example - 5 photos???
Download the attached file from first post of this thread.
Find:
if ($keywords_array[$i]) { // Eliminates Null Keywords
and replace it with
if ($keywords_array[$i] && $keyword_count[$keywords_array[$i]] >= 5) { // Eliminates Null Keywords
Haven't tried out but should work.
-
Thanks a lot Aditya! ;D
looks like is a good solution!
I¡ll try it this afternoon and let you know if works properlly.
p.s. I have a problem when i try to keyword manage:
database responds:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1311027 bytes) in /mounted-storage/home31b/sub001/sc204/www/website/gal/keywordmgr.php on line 83
Can someone help me ? ???
what happened? yesterday it was working fine...
shurely I have many keywords but alsaw a lot of free space on server, I dont understand.
www.tripodart.net (http://www.tripodart.net) this is the site. :-\
any suggestion is welcome.
-
Hy! ;D
I just tryed the modification limiting to 5 referring photos for keyword, as suggested by Aditya and worked fine.
I tryed to use a bigger lower limit to reduce number of keywords to only the ones referring to 10 photos- worked fine but....
resulted all keywords same (big) size.
Supose I have to change the first line:
$em = ($keyword_count[$keywords_array[$i]] < 6) ? 12 : (12 + (int)(($keyword_count[$keywords_array[$i]] - 5) / 5)) * 2;
if ($em > 24) {
$span = 'font-size: 24px; font-weight: bold;';
} else {
$span = "font-size: {$em}px;";
But have no idea of which numbers should I change. Can someone give me a little help?
Still unable to reach keyword manager.
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 262927 bytes) in /mounted-storage/home31b/sub001/sc204/www/website/gal/keywordmgr.php on line 83
Maby the problem is in the database?
Thanks a lot! ;)
-
Is there anyway to show the tags on anycontent.php ?
-
Ok...I fixed the duplicates using Solution #1 in Reply #16.
But I cannot get different sizes. I tried editing and finally just deleted all keywords and just
added one keyword to each picture. Still no change in size.
I see several posts where you mention an "original" search.inc.php.
Were we supposed to change something in that file. I can't find where you say to do that.
Help!
Thanks, Joe
Link --> http://www.dellwo.com/copper/search.php
-
Alright...I fixed it! I had to undo the duplicates fix from Repy #16 and do the reverse.
I Changed:
if (!in_array(strtolower($word),$keywords_array)) {
$keywords_array[] = $word;
To:
if (!in_array($word,$keywords_array)) {
$keywords_array[] = $word;
Also, the original script only did the Cloud tags in 2 sizes.
I played with the equation to get more increments.
I hope this helps others.
Thanks, Joe
-
hi there,
great mod! everything works all fine! I thought about including the tag cloud into my sidebar (like the link in post66 shows http://www.dellwo.com/copper/search.php), but as I see they did not really include the keyword.inc.php but rather found a way around it. It seems as you cant include the keyword.inc.php into the template.html anyway. I am not at all a pro and would be very glad to get some help with implementing my tag cloud into the cpg sidebar of the template.html if possible!
thank you very much guys
Pascal
-
great mod. just one think - how can I display the tags on main page of my coppermine gallery? thanks for answer!
-
See post #48 (http://forum.coppermine-gallery.net/index.php?topic=25311.msg204135#msg204135) above.
Joe [Gallery] (http://www.dellwo.com/copper/index.php)
great mod. just one think - how can I display the tags on main page of my coppermine gallery? thanks for answer!
-
Thanks but it doesnt work.
Nothing displays. I looked in that file anycontent.php where is written this: "this file file gets included in the index.php if you set the option in admin can be used to display any content from any program".
Where can I set this option in admin? I dont see it anywhere :(
-
Add "anycontent/" to "The content of the main page" in your config.
-
Great. It works. Thanks. And last question - what if i want to move it to some more visible place (for example somewhere on the top, right under the categories? :)
-
It goes wherever you place it in the config.
So put it after "catlist".
--Joe
Great. It works. Thanks. And last question - what if i want to move it to some more visible place (for example somewhere on the top, right under the categories? :)
-
@alanpalan: your questions are not related to this mod, but general coppermine questions. Read up the documentation that comes with it. If you then still have questions, ask them in a thread of your own on the support board.
-
hello
I use coppermine 1.4.14 . and I want use the tag cloud mod here.
how I must make this?
which files I must download? Can everyone upload the actualy files now, pls?
I thx you!
(sry for my english)
-
A file is attached to the first post in this topic. Just FYI, this mod is not yet tested with 1.4.14
-
yes but i want display keywords larger when they has more searchresult.
but my coppermine display two searchresult like one searchresult
=(
can me everyone help?
(Sry engslish)
-
and how can I display the cloud in anycontent?
include keywords.inc or what?
-
Everything you're asking has already been explained in this topic.
You should at least read the posts before asking questions.
-
Also, the original script only did the Cloud tags in 2 sizes.
I played with the equation to get more increments.
Can you, please, put this piece of code here?
-
Take a look at this section of keyword.inc.php.
This is how I modified it. You'll need to play with the equation according to your search results.
Later, Joe
// Sort selected keywords
sort($keywords_array);
$count = count($keywords_array);
// Result to table
echo '<tr><td class="tableb">' ;
for ($i = 0; $i < $count; $i++) {
if ($keywords_array[$i] && $keyword_count[$keywords_array[$i]] >= 3) { // Eliminates Null Keywords
$em = ($keyword_count[$keywords_array[$i]] < 6) ? 12 : (12 + (int)(2*$keyword_count[$keywords_array[$i]] / 5));
if ($em > 24) {
$span = 'font-size: 24px; font-weight: bold;';
} else {
$span = "font-size: {$em}px;";
}
-
Thanks a lot.
-
Those who had this problem of duplicates edited their keywords and everything worked fine thereafter.
hello
I have a problem..
I have edit my Keywords..but they are always duplicates words.. =(
-
See reply #67 or #16. ::)
-
@dellwo: thanks for pointing that out.
@DaBe: it's advisable to read the thread first before replying to it. ::)
-
hello
Now the tag cloud workd!
I have three different keyword sizes. Is there possible make more than three sizes?
// Sort selected keywords
sort($keywords_array);
$count = count($keywords_array);
// Result to table
echo '<tr><td class="tableb">' ;
for ($i = 0; $i < $count; $i++) {
if ($keywords_array[$i]) { // Eliminates Null Keywords
$em = ($keyword_count[$keywords_array[$i]] < 6) ? 12 : (12 + (int)(($keyword_count[$keywords_array[$i]] - 5) / 5)) * 2;
if ($em > 24) {
$span = 'font-size: 24px; font-weight: bold;';
} else {
$span = "font-size: {$em}px;";
}
-
Come on! Please read Reply #86. >:(
Also, a link to your site would be helpful.
-
in my includes folder i don't even have a keyword.inc.php file
-
It's the file in the first post, that you're supposed to download.
-
Thanks for the Tag Cloud Aditya, worked first time without any problems :-)
BIG Thanks - James
-
i installed this mod and it seemed to work fine.
BUT! i noticed that the sizes arent propotional to the amount of images i have keyworded. for instance, i have one keyword called "Shoes" and its big and bold but there are only 4 images within it. But then i have one called "canon_5D" with 5 pages of images and its small like the regular keyword font. It almost seems as though the sizing is random? or am i missing somthing?
Thanks in advance for any info!
-
Did you modify the font size equation in keyword.inc.php?
If so, please post it.
-
hello is there possible to display the count of images in () like = keyword (14) ???
thx..
-
Change
echo "<a href=\"thumbnails.php?album=search&search=".$keywords_array[$i]."\"><span style='$span'>$keywords_array[$i]</span></a>";
to
echo "<a href=\"thumbnails.php?album=search&search=".$keywords_array[$i]."\"><span style='$span'>$keywords_array[$i] ({$keyword_count[$keywords_array[$i]]})</span></a>";
-
thx for the fast answer!
-
Thanks for this mod, it was easy to put in.
I'm wondering how to change the limit for 3 font sizes in relation to how many images the keyword results in?
For example:
The smallest font would be keywords that in less than 100 images
Medium font size would be keywords that result in 100-1000 images
And the biggest font size would be keywords that display over 1000 images
I think it goes with
$em = ($keyword_count[$keywords_array[$i]] < 6) ? 12 : (12 + (int)(($keyword_count[$keywords_array[$i]] - 5) / 5)) * 2;
but every time I edit any of these numbers, all my keywords become the same font size
-
I wonder how to get displayed only 10 random keywords
-
I wonder how to get displayed only 10 random keywords
OK, did it! code here:
change:
sort($keywords_array);
$count = count($keywords_array);
to:
shuffle($keywords_array);
$count = 10;
-
will this work with coppermine 1.4.25 ?
-
This thread is tagged as being for cpg1.4.x. In my book, this includes cpg1.4.25 as well as cpg1.4.3819. So yes, this mod is designed to be used with any version of the cpg1.4.x series, and this includes cpg1.4.25.
We can't tell for sure, as it's simply beyond the scope of this board to test each available mod or hack with each new maintenance release. Why don't you try it for us: apply the mod and let us know if it worked for you or not. This would be a good way to give something back to the community. Taking into account your negative record on this forum it's about time for you to become a giver instead of being a taker constantly. Don't come up with lame excuses like "I'm not a coder" - you don't need to be a coder to apply this mod, test if it works and post feedback here in this thread. Nobody has been born as a coder - you live and learn.
Anyway, I can see what your issue is: this mod suggests to replace one of coppermine's files with a modified file that is based on an outdated version of coppermine, which can be a bad idea in terms of security and stability. The instructions of this mod never should have been put the way they are. I will try to make that up and post instructions that should work (see next posting).
-
Here are the revised instructions to use this mod: do not replace the entire core file as the initial posting in this thread suggests. Instead, apply these steps:
Edit include/keyword.inc.php with a plain text editor
Find $keywords_array = array();
and add after it (into a new line) $keyword_count = array();
Find if (!in_array($word = utf_strtolower($word),$keywords_array)) $keywords_array[] = $word;
and replace with if (!in_array(strtolower($word),$keywords_array)) {
$keywords_array[] = $word;
$keyword_count[$word] = 1;
} else {
$keyword_count[$word]++;
}
Find echo "<a href=\"thumbnails.php?album=search&search=".$keywords_array[$i]."\">$keywords_array[$i]</a>";
and replace with $em = ($keyword_count[$keywords_array[$i]] < 6) ? 12 : (12 + (int)(($keyword_count[$keywords_array[$i]] - 5) / 5)) * 2;
if ($em > 24) {
$span = 'font-size: 24px; font-weight: bold;';
} else {
$span = "font-size: {$em}px;";
}
echo "<a href=\"thumbnails.php?album=search&search=".$keywords_array[$i]."\"><span style='$span'>$keywords_array[$i]</span></a>";
Find echo " | ";
and replace with echo " ";
-
Thank you Joachim Müller for the help. I use dreamweaver as my editor. I edited the file as you said & attached herewith this post. But sadly i m unable to find the tag cloud on search page.I edited the keyword.inc.php in the include dir. & made a text copy & attached with my post.
http://www.orangewallpapers.com/search.php
-
Its working, thank you GuaGau for the help. Anyone can download the attachment file from this post, rename it to keyword.inc.php & overwrite incude/keyword.inc.php. Thank you for the mod. It will bring a tag cloud on search.php.
http://www.orangewallpapers.com/search.php
-
Anyone can download the attachment file from this post, rename it to keyword.inc.php & overwrite incude/keyword.inc.php.
No, that's exactly what people should not do. Instead, they should to as I suggested above and apply the mod with the FIND/REPLACE instructions posted above. It was a silly idea in the first place to offer a pre-modded file. That idea was corrected. I understand that you're trying to help others, but it's a bad idea to continue with something that was a bad idea in the first place.
-
Thank you ;) ;)
-
Thank you ;) ;)
_________________________________________________
Abu Ja football Lani was used instead of dice. gclub (http://www.topstarclub.com/gclub.php) in South Africa. To create a high with gclub different these
-
http://www.3n2.net/sbobet.html
http://www.3n2.net
-
http://www.3n2.net/sbobet.html
http://www.3n2.net
aha... ;D
-
Just added a new member for the first time.
-
Hello everyone I just came Register. Thanks for the great info.
__________________________________________________________________________________________________
คาสิโนออนไลน์ (http://casino-onlineslot.com/)-คาสิโน (http://casino-onlineslot.com/)-แทงบอล (http://www.3n2.net/stepsoccer.html)-แทงบอลออนไลน์ (http://casino-onlineslot.com/)-บาคาร่าออนไลน์ (http://casino-onlineslot.com/)