Quantcast
Channel: Forum Pasja Informatyki - Najnowsze pytania bez odpowiedzi
Viewing all articles
Browse latest Browse all 21993

Problem z JCloud

$
0
0

Witam, mam problem, chciałbym użyć fajnej chmury tagów. http://mistic100.github.io/jQCloud/demo.html . Mam problem gdy moje tagi trafiają z bazy danych one się nie wyświetlają. W konsoli mam błąd Uncaught SyntaxError: Unexpected token < index.php:11. 

Tak wygląda mój kod: 

<!DOCTYPE html><html><head><title>jQCloud Example</title><link rel="stylesheet" type="text/css" href="../jqcloud/jqcloud.css" /><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script><script type="text/javascript" src="../jqcloud/jqcloud-1.0.4.js"></script></head><body><?php
		echo "<script>
				var word_list = [";

				$pdo = new PDO('mysql:host=localhost;dbname=blog','root');

				$sql = "SELECT p.tags FROM posts as p WHERE  p.idpost = '2'";
				$question = $pdo->query($sql);
				$result = $question->fetch();
				$tags = $result['tags'];

				foreach ($tags as $value) {
					$procent = rand(8, 13);
					echo "{text: '$value', weight: $procent , link: 'category.php?tag=$value'},";
				}

		echo "];";
	?>

   $(function() {
        $("#my_favorite_latin_words").jQCloud(word_list);
      });</script><h1>jQCloud Example</h1><div id="my_favorite_latin_words" style="width: 550px; height: 350px; border: 1px solid #ccc;"></div></body></html>

 


Viewing all articles
Browse latest Browse all 21993