Php tags display -


4 tables are used to store tags:

  TEGOVI_VISGSTY, TEGOVI_LOGOVY, TEGOVI_DOGADDEN  

structure od table tagovi :

  id - name  
< P> The structure of the table is tagovi_vijesti :

  id - vijesti_id - tag_id  

The same is for the other two tables.

On the main page, I display the tags from all the three tables like this:

  $ sql = "SELECT T.ID as id, T.name as tag, TV.id as tag_vijest_id, TD.id AS Tag_dogadjan_id, TB.ID AS tag_ballag_ID, Tag (blog) as taggate (adt left job) T.V.V.V.V. TV on TV as TV_vijesti, excluding TAG_ID, taggi_dogadjya TD on T.ID = TD.T.G.ID Left Join Tagoavi_BlogVi TB on T.id = TB.tag_id WHERE There is no zero group in the id order by TV.ID IID DESC limit 5 "; $ Sql_result = mysql_query ($ sql, $ connect) or die ("uptiz ignorance"); While ($ row = mysql_fetch_array ($ sql_result)) {$ tag_id = $ line ["id"]; $ Tag_url = $ line ["tag"]; $ Tag = preg_replace ('/ - /', '', $ tag_url); $ Tag_ponavljanje = $ line ["Pages"]; If ($ tag_ponavljanje> = 10 & amp; $ tag_ponavljanje & lt; 20) $ fontSize = "14px"; Otherwise ($ tag_ponavljanje> = 20 & amp; $ tag_ponavljanje & lt; 30) $ fontSize = "16px"; Otherwise ($ tag_ponavljanje> = 30 & $ tag_ponavljanje & lt; 40) $ fontSize = "18px"; Otherwise ($ tag_ponavljanje> = 40 & $ tag_ponavljanje & lt; 60) $ fontSize = "20px"; Otherwise ($ tag_ponavljanje> = 60) $ fontSize = "24px"; And $ fontSize = "12px"; Echo "& amp; nbsp; & lt; a href = \" $ ispisi_link / tag / $ tag_url \ "style = \" font-size: $ font size; \ "& Gt; $ tag & lt; / a & gt; & amp; nbsp;"; }  

But I do not think this is the right way to do this because tags are sorted by ID and then all those old tags will never be displayed because the results are sorted by ID. Go. What type of display (query) do you use? What advice would you give me to display the tag? Is it better to sort them according to the repetition of each tag (the repetition in my table is called "Ponvaljeje")? If I use this way I am afraid that tags will be replicated in most of the contents and the new page will never be displayed on the main page. Or can I use two questions, for a new tag and for most of these people who are used?

Thanks, Ile

You can mix both of them by adding them to a table (This way you have the best way of both worlds).

So if you were going to tag a select cloud of 20 tags, select 10 most tags and 10 random ones.

ORDER BY RAND () can be very hard if you have a lot of tags, though Arkh has mentioned that alternatively you can insert each tag with a random integer and after that Column can be indexed. If you want to reshuffle the tag later, you can reassign the random values ​​in that column.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -