Joined: Mar 30, 2006 Posts: 2404 Location: Pennsylvania
Posted:
Fri Nov 07, 2008 11:03 pm
Well generally speaking there only a few general things you need do.
First is change the $dbi global (Your block my have more globals)
Code:
global $prefix, $dbi;
Code:
global $prefix, $db;
Then you need to remove the $dbi from all the quries.
Code:
$result = sql_query("select lid, title, hits, url from ".$prefix."_links_links order by linkratingsummary DESC limit 0,$mainlinkstoshow", $dbi)
Code:
$result = sql_query("select lid, title, hits, url from ".$prefix."_links_links order by linkratingsummary DESC limit 0,$mainlinkstoshow")
Finally you have to change the "query functions"
Code:
sql_query("select lid, ti .........
Code:
$db->sql_query("select lid, ti .........
You need to be carefull because all the functions are not like sql_query were you just append the $db->. For example with the old $dbi way you used sql_fetch_row(), but with the new way it has to be written $db->sql_fetchrow(). There are only a couple of functions that you will need to change, so just check in the newer blocks if you need help with one. Off the top of my head I can't think of the other functions that are different from old to new.
Joined: Aug 30, 2005 Posts: 3136 Location: near Albany NY
Posted:
Sat Nov 08, 2008 7:37 am
You might also want to turn database error reporting on (see documentation in rnconfig) when you are doing the conversion and monitor the dblog file. Of course, if the function never gets to the database layer it won't show up in the log but it could show any function calls that aren't correct.
Just remember to turn the error reporting off when you are done or else monitor the dblog regularly.
Ty Palbin!......my wife isn't to happy though....lol. I have spent a lot of time lately going through php files and code books. Thanks again for the nudge in the right direction.....
Followed the instructions closely I think but my last 10 forums block, center down, in table format does not work. When activated, the left and right side blocks are missing altogether, here's the code:
Code:
<?php
########################################################################
# PHP-Nuke Block: fiplain Center Forum Block v.2 #
# Made for PHP-Nuke 6.5 and up #
# #
# Made by mikem http://www.nukecops.com #
# This block is made only to match the fiplain Theme pack #
# #
########################################################################
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License. #
# If you modify this, let me know for fun. =) #
########################################################################
if (eregi("block-fiplain-Forums.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
$result2 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$topic_poster'");
list($username, $user_id)=$db->sql_fetch_row($result2);
$avtor=$username;
$sifra=$user_id;
$result3 = $db->sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'");
list($poster_id, $post_time)=$db->sql_fetch_row($result3);
$result4 = $db->sql_query("SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetch_row($result4);
I created the file "dblog". Is that it, no extension? Also did the permissions to 666 but I get nothing in the file when trying my top 10 forums file above.
Edit: Cripes, I placed it in the root instead of /rnlogs and there is already a dblog file there, just had to change the permissions.
And nothing shows up in the dblog when the broken block is activated.
Cheers, Jay
Last edited by dad7732 on Wed Dec 24, 2008 8:11 am; edited 1 time in total
Edit: I missed the fetch_row but changed it to fetchrow but didn't change anything.
Already did that, no luck.
Cheers, Jay
EDIT: The block may be too "old" to modify. If that is the case I would like a compatible "Last Posts" block in table format, not like the "block-forums.php" that is included.
Nothing posted here is working to convert my particular block. Since when the block is activated, the right and left blocks are completely missing which leads me to believe that it's more serious than just DB conversion.
Joined: Mar 30, 2006 Posts: 2404 Location: Pennsylvania
Posted:
Fri Dec 26, 2008 10:20 am
The big difference is that I added in some code to allow the block to consider the users time zone. The times in the block should match the times in the forums.
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum