Hello; I have got a dictionary website. It consists of three pages: index and two result pages. Naturally, I believe, it is not indexed by search engines. I think I need a tag cloud but I don't know how to make it. I have made a search and there were results and examples showing how to make tag clouds. However, I could find none that could make it out of a database. All the words and definitions are in a database.
Tag Cloud scripts are just based on hits to an item, well that would be the simplest form. So basically all your doing is selecting items with the highest hit count and displaying those in a fancy format. Which means you need a hit field added to your database words table. If you post up some code you found, I am sure someone or even myself will alter it so it reads from a db instead.
Here is a code that I found. It simply makes a list of the words but it is only a list. Moreover, nothing happens when you click on them. Note that my purpose is to get recognized by search engines. Therefore, the tag cloud can remain in a seperate file, if possible. Thanks in advance. $query = "SELECT word AS tag, COUNT(id) AS quantity FROM mydatabase GROUP BY word ORDER BY word ASC"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $tags[$row['tag']] = $row['quantity']; } $max_size = 250; $min_size = 100; $max_qty = max(array_values($tags)); $min_qty = min(array_values($tags)); $spread = $max_qty - $min_qty; if (0 == $spread) { $spread = 1; } $step = ($max_size - $min_size)/($spread); foreach ($tags as $key => $value) { $size = $min_size + (($value - $min_qty) * $step); echo '<a href="kelime1.php" style="font-size: '.$size.'%"'; echo ' title="'.$value.' thing tagged with '.$key.'"'; echo '>'.$key.'</a> '; } Code (markup):
Just an opinion, but a site map might suite you better. Which is really all that script above does, ie: it creates links, by words
A sitemap of 3 pages? I don't think that would help as the real content is in the database. Moreover, the links it creates doesn't work
You need to change your php script so the "words" can be captured and then processed into working urls like ursite.com/word then you can use the script above. I can help you with that, if you want to post the script here in or a PM etc...
I want the search result to appear in the browser address bar like this: .../result.php?s=word The "word" will be replaced with the actual word being looked up. In this way, I believe, I will be able to provide links for the results, which I can use with the tags.
That's what I meant, to get your started, use the word GET on your forum instead of POST that will give you ?s=word, however on your forum your not using the letter s so you need to change that as well... and to continue on, if you add a little htaccess trick you can turn ?s=word in to /word or /word.htm
Thank you very much MyVodafone; it works! I didn't know that it would be so simple. However, what appears is not exactly what I wanted. This is what I get when I look up the word "able", for example: .../kelime1.php?kelime=able&Submit=+++++Bak+++++++ Why do I have the "&Submit=+++++Bak+++++++" extension after that word? "Bak" is the name of the submit bottton. By the way, what kind of change shall I apply to the htaccess?
Well, I can get the link to a word by typing .../kelime1.php?kelime=able and that is what I needed. Thank you very much. By the way how does the magic with the htaccess work? What shall I exactly do?
Just to clarify, these methods are the basics and there are other ways, preferable ways etc... but to get you going heres a quick way. You do need to remove the name=bak from your submit button, the url must be /kelime1.php?kelime=word for it to work. Create a .htaccess file and place the following in to it. Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^([^/]+)\.htm?$ kelime1.php?kelime=$1 [L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /kelime1\.php\?kelime=([^&]+)\ HTTP/ RewriteRule ^kelime1\.php$ /%1\.htm? [R=301,L] PHP: You can remove the .htm if you wish, its optional.
Thank you very much indeed. I don't know how to thank you. Should I click the + at the right bottom corner? Is this +rep that you mention in the signature? I can also give you a featured link on my directory website. I am not sure that would be enough help because I have been searching the internet several days to find an answer.