The Site
I finally got around to it
Well, what have I done? I've fixed the tag cloud. If any thing its actualy simpler code now, but it works correctly.
Before it used to spread the tags equaly, now that might be fine for some people, but as it seems 90% of my tags only have one entry, it really didn't work right. You'd end up with one tag being tiny, and another one large, just because it was later in the alphabet.
I also had the class sizes upside down, now that was just stupid of me but untill I had lots of data, and it generated correctly I couldn't tell.
So now the size is bigger for the more common tags, and all the tags with 1 post as the same size. It actualy looks better now.
I guess the real differance is rather then spreading the tags equaly through the groups, it now spreads the occurances. Right at the moment I am not sure how to explain it, but I'll post the code here, just because I am feeling in that kind of mood. I could explain it, but I've had a head ache all day and I don't much feel like thinking to hard, and translating code to english isn't really my thing.
function GenerateTagCloud($account_id="", $tagLimit=300) {
$Result = False ;
$NumberOfTags = $this->UniqueTagCount() ;
$TagsInSet = Ceil($NumberOfTags / 7) ;
// returns an array of id/value pairs "id" and "tag"
$Result = false;
if ($account_id != "") {
$ExtraTable = ", entries e, users u " ;
$ExtraWhere = " et.entry_id = e.entry_id and e.user_id =
u.userid and u.account_id = $account_id and " ;
}
$GetTagsSQL = "SELECT t.tag_id, t.tag, COUNT(et.entry_id) AS Occurance FROM ".
_TAGS_TABLE_NAME." t, entry_tags et $ExtraTable WHERE $ExtraWhere et.tag_id = t.tag_id
GROUP BY t.tag_id ORDER BY Occurance " ;
if ($tagLimit > 0) {
$GetTagsSQL .= " LIMIT $tagLimit " ;
}
$GetTagsQuery = PerformQuery($GetTagsSQL) ;
If ($GetTagsQuery) {
$ResultArray = Array() ;
while ($row = FetchRow($GetTagsQuery)) {
$occurance = $row['Occurance'] ;
$Tag = $row['tag'] ;
$TempArray['tag'] = $Tag ;
$TempArray['count'] = $occurance ;
$ResultArray[$occurance][count($ResultArray[$occurance])] = $TempArray ;
}
}
if (count($ResultArray) > 0) {
$occurancesPerset = Ceil(count($ResultArray) / 7) ;
$tagGroupCount = 0 ;
$tagSetId = 1 ;
$resultTagsArray = Array() ;
foreach ($ResultArray AS $tagSet) {
foreach ($tagSet as $tag) {
$tagName = $tag['tag'] ;
$resultTagsArray[$tagName] = $tag ;
$resultTagsArray[$tagName]['classsize'] = $tagSetId ;
}
$tagGroupCount = $tagGroupCount + 1 ;
if ($tagGroupCount == $occurancesPerset) {
$tagGroupCount = 0 ;
$tagSetId = $tagSetId + 1 ;
}
}
}
sort($resultTagsArray) ;
return $resultTagsArray ;
}
Changed servers, its back, and its better.
Now the new server up, and running and I've had a spare couple of mins to set this site back up its all good. Dedicated servers are all well and good but after a year of problems with host centric we finally had enougth, bit the bullet and moved.
It seems better, images don't just fail to load, its faster and generaly better. I'm happy. Now I just have to reinstall all the other sites. The most suprising thing was when I dumped the database it turned out I had 1,337, 821 lines of SQL... thats one hell of a file.
Any way, its now working, we'll see how it goes with this server I guess...
Onwards and upwards
Well, I've had a good weekend, got some thing done for a change. The site now accepts comments, so if you have some thing to say about what I have said, feel free to do so...
Though try to keep it fairly clean :-)
It's getting there
Exciting ha?



