Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] Tag Cloud
allex
post 24.03.2007, 17:00:00
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 3.12.2003
Skąd: Ustka

Ostrzeżenie: (0%)
-----


Witam. Znalazłem w sieci skrypt do wyświetlania tgz. Tag Cloud na stronie ale nie bardzo mi chce działać.
  1. <?PHP
  2. function get_tag_data() {
  3. $arr = Array('Actionscript' => 35, 'Adobe' => 22, 'Array' => 44, 'Background' => 43, 
  4. 'Blur' => 18, 'Canvas' => 33, 'Class' => 15, 'Color Palette' => 11, 'Crop' => 42, 
  5. 'Delimiter' => 13, 'Depth' => 34, 'Design' => 8, 'Encode' => 12, 'Encryption' => 30, 
  6. 'Extract' => 28, 'Filters' => 42, 'Flash' => 32, 'Functions' => 19, 
  7. 'Gaussian Blur' => 44, 'Grafix' => 49, 'Graphics' => 35, 'Hue' => 47, 'Illustrator' => 8, 
  8. 'Image Ready' => 12, 'Javascript' => 47, 'Jpeg' => 15,  'Keyboard' => 18, 'Level' => 28, 
  9. 'Liquify' => 30, 'Listener' => 10, 'Logo' => 12, 'Loops' => 22, 'Macromedia' => 26, 
  10. 'Method' => 28, 'MySQL' => 18, 'Obfuscation' => 13, 'Object' => 39, 'Optimize' => 25, 
  11. 'PDF' => 37, 'PHP' => 44, 'PSD' => 17, 'Photography' => 28, 'Photoshop' => 46, 
  12. 'Revert' => 50, 'Saturation' => 35, 'Save as' => 28, 'Scope' => 11, 'Scripting' => 9, 
  13. 'Security' => 41, 'Sharpen' => 49, 'Switch' => 41, 'Templates' => 11, 'Texture' => 22, 
  14. 'Tool Palette' => 30, 'Variables' => 50);
  15. return $arr;
  16. }
  17. function get_tag_cloud() {
  18. }
  19. $min_font_size = 12;
  20. $max_font_size = 30;
  21.  
  22.  
  23. $tags = get_tag_data();
  24.  
  25. $minimum_count = min(array_values($tags));
  26. $maximum_count = max(array_values($tags));
  27. $spread = $maximum_count - $minimum_count;
  28.  
  29. if($spread == 0) {
  30. $spread = 1;
  31. }
  32. $cloud_html = '';
  33. $cloud_tags = array();
  34. foreach ($tags as $tag => $count) {
  35. $size = $min_font_size + ($count - $minimum_count) 
  36. * ($max_font_size - $min_font_size) / $spread;
  37. $cloud_tags[] = '<a style="font-size: '. floor($size) . 'px' 
  38. . '" class="tag_cloud" href="http://www.google.com/search?q=' . $tag 
  39. . '" title="'' . $tag . '' returned a count of ' . $count . '">' 
  40. . htmlspecialchars(stripslashes($tag)) . '</a>';
  41. }
  42. $cloud_html = join("n", $cloud_tags) . "n";
  43. return $cloud_html;
  44. ?>

Czy ktoś wie co jest z nim nie tak?

Ten post edytował allex 24.03.2007, 17:03:53


--------------------
| Wyposażenie gastronomii | Wiadomości RSS | Walcz ze SPAMEM |
Go to the top of the page
+Quote Post
Ociu
post 24.03.2007, 18:29:41
Post #2





Grupa: Moderatorzy
Postów: 1 566
Pomógł: 37
Dołączył: 14.05.2003
Skąd: Kraków




A co się dziej ? Różowe słonie latają po stronie ?
Go to the top of the page
+Quote Post
allex
post 24.03.2007, 18:33:40
Post #3





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 3.12.2003
Skąd: Ustka

Ostrzeżenie: (0%)
-----


Nie! Fruwają białe myszki. Właśnie o to chodzi, że nic się nie dzieje i nic nie wyświetla!!


--------------------
| Wyposażenie gastronomii | Wiadomości RSS | Walcz ze SPAMEM |
Go to the top of the page
+Quote Post
Ociu
post 24.03.2007, 18:50:13
Post #4





Grupa: Moderatorzy
Postów: 1 566
Pomógł: 37
Dołączył: 14.05.2003
Skąd: Kraków




Ale masz odlot, mi nigdy białe myszki nie latały po stronie :/
daj print_r($tags);
i przed join" title="Zobacz w manualu PHP" target="_manual daj print_r($cloud_html);

Sory, oczywiście chodziło o $cloud_tags.

Ten post edytował Ociu 24.03.2007, 18:51:24
Go to the top of the page
+Quote Post
devnul
post 24.03.2007, 18:59:51
Post #5





Grupa: Zarejestrowani
Postów: 1 470
Pomógł: 75
Dołączył: 21.09.2005
Skąd: że znowu

Ostrzeżenie: (0%)
-----


  1. <?php
  2. function get_tag_data() {
  3. $arr = Array('Actionscript' => 35, 'Adobe' => 22, 'Array' => 44, 'Background' => 43, 
  4. 'Blur' => 18, 'Canvas' => 33, 'Class' => 15, 'Color Palette' => 11, 'Crop' => 42, 
  5. 'Delimiter' => 13, 'Depth' => 34, 'Design' => 8, 'Encode' => 12, 'Encryption' => 30, 
  6. 'Extract' => 28, 'Filters' => 42, 'Flash' => 32, 'Functions' => 19, 
  7. 'Gaussian Blur' => 44, 'Grafix' => 49, 'Graphics' => 35, 'Hue' => 47, 'Illustrator' => 8, 
  8. 'Image Ready' => 12, 'Javascript' => 47, 'Jpeg' => 15,  'Keyboard' => 18, 'Level' => 28, 
  9. 'Liquify' => 30, 'Listener' => 10, 'Logo' => 12, 'Loops' => 22, 'Macromedia' => 26, 
  10. 'Method' => 28, 'MySQL' => 18, 'Obfuscation' => 13, 'Object' => 39, 'Optimize' => 25, 
  11. 'PDF' => 37, 'PHP' => 44, 'PSD' => 17, 'Photography' => 28, 'Photoshop' => 46, 
  12. 'Revert' => 50, 'Saturation' => 35, 'Save as' => 28, 'Scope' => 11, 'Scripting' => 9, 
  13. 'Security' => 41, 'Sharpen' => 49, 'Switch' => 41, 'Templates' => 11, 'Texture' => 22, 
  14. 'Tool Palette' => 30, 'Variables' => 50);
  15. return $arr;
  16. }
  17. function get_tag_cloud() {
  18. $min_font_size = 12;
  19. $max_font_size = 30;
  20.  
  21.  
  22. $tags = get_tag_data();
  23.  
  24. $minimum_count = min(array_values($tags));
  25. $maximum_count = max(array_values($tags));
  26. $spread = $maximum_count - $minimum_count;
  27.  
  28. if($spread == 0) {
  29. $spread = 1;
  30. }
  31. $cloud_html = '';
  32. $cloud_tags = array();
  33. foreach ($tags as $tag => $count) {
  34. $size = $min_font_size + ($count - $minimum_count) 
  35. * ($max_font_size - $min_font_size) / $spread;
  36. $cloud_tags[] = '<a style="font-size: '. floor($size) . 'px' 
  37. . '" class="tag_cloud" href="http://www.google.com/search?q=' . $tag 
  38. . '" title="'' . $tag . '' returned a count of ' . $count . '">' 
  39. . htmlspecialchars(stripslashes($tag)) . '</a>';
  40. }
  41. $cloud_html = join("n", $cloud_tags) . "n";
  42. return $cloud_html;
  43. }
  44. echo get_tag_cloud();
  45. ?>

a teraz?

Ten post edytował devnul 24.03.2007, 19:00:26


--------------------
Profesjonaliści są przewidywalni...
strzeż się amatorów...
FL4SHB4CK - imprezy, galerie, lokale
Go to the top of the page
+Quote Post
--styljola--
post 7.03.2008, 18:17:01
Post #6





Goście







A w jaki sposób odpala się go na stronie wstydnis.gif
Go to the top of the page
+Quote Post
devnul
post 7.03.2008, 18:50:41
Post #7





Grupa: Zarejestrowani
Postów: 1 470
Pomógł: 75
Dołączył: 21.09.2005
Skąd: że znowu

Ostrzeżenie: (0%)
-----


RDFM


--------------------
Profesjonaliści są przewidywalni...
strzeż się amatorów...
FL4SHB4CK - imprezy, galerie, lokale
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 12.07.2025 - 07:45