bloli
Forum Replies Created
-
Forum: Plugins
In reply to: dynamic menu: Tags sorted by post viewsIt’s dooooone!!!! 😀 Hooray!
Here’s the final function:
function TagValueBestimmen($term) { $term_id = $term->term_id; $tag_value = $term->tag_value; $count = $term->count; $newtv = (1+$tag_value*$count)/$count; mysql_query("UPDATE wp_term_taxonomy SET tag_value = $newtv WHERE term_id = $term_id;") or die("failed"); }The function is “opened” (don’t know the correct term here) in the foreach-loop of get_the_term_list (category-template.php) and a modified version of the “New Tag Cloud” (http://wordpress.org/extend/plugins/new-tag-cloud/) dumps the data as a menu.
Forum: Plugins
In reply to: dynamic menu: Tags sorted by post viewsHere I am… again! ^^ But I can already show some results! The problem nevertheless isn’t solved completely, yet.
Here’s the function I have written:function TagValueBestimmen($term) { $term_id = $term->term_id; $tag_value = $term->tag_value; $count = $term->count; $newtv = (1+$tag_value*$count)/$count; var_dump($newtv); //Here's the problem: //$sql = 'INSERT INTO $wpdb->term_taxonomy(tag_value) VALUES ($newtv) WHERE term_id = $term_id;'; }The var_dump of $newtv dumps the correct value. So, everything’s fine up to that point.
But then $newtv must be written into the MySQL-tables – and I don’t know how this works. As I’ve already said I’m new to PHP, all I know comes from various Tutorials, I have absolutely no experiences with that…
Here’s what should be done: the value of $newtv should be written into the column “tag_value” from the table “term_taxonomy” in the row in which “term_id” is equal to the parameter $term_id.So, here we go again: Can anyone please help me?
Forum: Plugins
In reply to: dynamic menu: Tags sorted by post viewsHere’s a first approach (it’s the first time, I’ve written php-code, so I’m sure that it’s full of mistakes):
<?php $sql = 'SELECT term_value, count FROM term_taxonomy'; $result = $wpdp->query($sql); insert($wpdb->term_taxonomy.term_value, (1+$result[term_value]*$result[count])/$result[term_value]); ?>Is it already pointing in the right direction?! What do I have to change and to add?! …
Forum: Plugins
In reply to: dynamic menu: Tags sorted by post viewsThanks, Michael! I installed the plugin and it’s really good!
But I still can’t handle the problem (and I don’t want to hire anyone, because actually I don’t want to spend any money for the launch of my blog… ^^).
So, I thought about the calculation again:The new idea (Hooray!)
tagX: (sum of views of the posts, tagged with tagX) / (addends or frequency of use of tagX) = Value for the interest for tagX
or simplified:
a/b=c <=> c=a/bI think I have to create a new column in the MySQL-tables for the result anyway – no matter how I realize this thing. So, the data which I need for “c” will be available (e.g. $wpdb->term_taxonomy.term_value or sth. like that). And the data I need for “b” is already available: $wpdb->term_taxonomy.count
The only information I don’t have is the one for “a”. And because I don’t want to grapple with this problem too long, I thought about “abolishing” “a”:c=a/b <=> a=cb
c=cb/b (<= not correct, yet!)When the function is opened, it should add “1” to “cb”, so it counts the number of “openings”:
c=(cb+1)/b
But the question still remains: How can I realize this?! I think the basic structure is much more easier now. But with my lack of php-knowledge, it’s still too difficult for me. So, please help me.