I'm trying to come up with a way for a forum block to recognise the default theme of the users. Everytime I think I have it, I get a parse error. I've tried modding both the scrolling forum block that is included with phpbb port 2.0.6 and the last 5 posts block that was created by Coldblooded over at nukemods.
Anyone know how to tell the script to look up the exsisting theme, including the cells and images?
I tried adding this, and I get a parse error.
Code:
$ThemeSel = get_theme();
if (file_exists("themes/$ThemeSel/forums/$name/$file.php")) {
$modpath = "themes/$ThemeSel/";
if (is_active("$default_forum") AND file_exists("forums/$default_template/index.php")) {
$def_forum = $default_forum;
} else {
$def_forum = "";
I'm thinking it probably needs to look for user info to, but I don't know where to put that, $user is included in the Global commands immediately before this.
Am I way off base on this?
ArtificialIntel
Joined: Jan 31, 2004
Posts: -88
Posted:
Wed Jan 15, 2003 3:30 pm
use an SQL query.
If you are after the phpBB default theme, make it look in nuke_bbconfig
if you're after the nuke default theme, then make it look in nuke_config
The Default_Theme field is a good place to look wihtin that table.
artificialINtel
chatserv General
Joined: Jan 12, 2003
Posts: 3128
Location: Puerto Rico
Posted:
Wed Jan 15, 2003 3:38 pm
It is always a good idea when posting this type of code, that when it gives you some type of error always point potential helpers to the line that gives out the error, by the way interesting idea.
_________________ Feed a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
ScriptHeaven | NukeResources
Zhen-Xjell Nuke Cops Founder
Joined: Nov 14, 2002
Posts: 5939
Posted:
Wed Jan 15, 2003 3:51 pm
Or you can take a look at the Your_Account code for changing a theme... the users default theme shows up first:
_________________ Paul Laudanski, Microsoft MVP Windows-Security
CastleCops: [de] [en] [wiki]
IACOJ Guest
Posted:
Wed Jan 15, 2003 5:58 pm
Thank you all, hopefully one of your suggestions will work.
chatserv
Sorry about that. The parse error has always been on the last line of code. ?>
chatserv General
Joined: Jan 12, 2003
Posts: 3128
Location: Puerto Rico
Posted:
Wed Jan 15, 2003 6:18 pm
Thanks for the extra info, do let us know how it goes. I grabbed the last 5 posts blocks and know that it displays a table with post title, replies, author, etc, if you still want to use that one let us know how you'd like the theme to be listed .
_________________ Feed a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
ScriptHeaven | NukeResources
IACOJ Major
Joined: Jan 15, 2003
Posts: 1269
Location: USA
Posted:
Thu Jan 16, 2003 11:47 pm
I took the "get theme" previous mentioned out (do I still need that?), and tried your solutions. I'm still getting parse errors. Please before you read the code bare in mind that I am new to php (virgin), so you might want to put something soft on the floor to fall on so you don't bash your head.
I have removed all reference in the script to a specific template. The sql queries are as follows, only the 5th one, which I'm sure is VERY wrong is mine. I'm not sure if I can integrate it in with another, or if it is completely wrong. I have tried several different variables in the 5th query, they all come back with a parse error on the last line shown in the code below it doesn't matter what I do.
$result2 = sql_query("SELECT uname, uid FROM ".$prefix."_users where uid='$topic_poster'", $dbi);
list($uname, $uid)=sql_fetch_row($result2, $dbi);
$avtor=$uname;
$sifra=$uid;
$result3 = 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'", $dbi);
list($poster_id, $post_time)=sql_fetch_row($result3, $dbi);
$result4 = sql_query("SELECT uname, uid FROM ".$prefix."_users where uid='$poster_id'", $dbi);
list($uname, $uid)=sql_fetch_row($result4, $dbi);
$result5 - sql_query ("SELECT user_theme, FROM ".$prefix."._users where user_theme='$forum_id'", $dbi };
list ($user_theme)=sql_fetch_row($result5, $dbi);
In addition to this, I have also tried include "modules\My_account\index.php' that gave me a parse error on line 21 which reads
Code:
$HideViewReadOnly = 1;
I have also tried changing the "1" to "0" that gives me a parse on line 22.
I know there has to be a way to do this. I'm actually encouraged by the fact that I am now getting errors in the middle of the code as opposed to the close code of php.
I've been going through all my php books, searching on the web etc, and I can't figure it out. I've tried calling in several other php files, thought about creating one that contains all the info you need (sorta like index.php but specific to the forum block), but figured that would be redundant considering the info is already there. I have made at least 50 different revisions to this file, probably 20 before I first posted here, and I'm at a complete loss now.
Can someone tell me what I'm doing wrong? Please be brutally honest, if I'm an idiot and don't have a clue, PLEASE say so. I wont take it personally, and I would rather know, then walk around in a deluded state thinking I might actually have the slightest idea what I'm doing.
_________________ Paul Laudanski, Microsoft MVP Windows-Security
CastleCops: [de] [en] [wiki]
IACOJ Major
Joined: Jan 15, 2003
Posts: 1269
Location: USA
Posted:
Fri Jan 17, 2003 1:25 am
WHOO HOO! Sort of success
I removed the 5th sql query, and put the code you stated above immediately following the global line.
It shows up, BUT the colors seriously WRONG! The current default on my test site is XPOlive, and the colors area cross between emerald and fiblack. You can see it here
This is coldblooded's script, I added it to FB's script to, and it didn't do anything except add the text at the top that says "your theme"
Zhen-Xjell Nuke Cops Founder
Joined: Nov 14, 2002
Posts: 5939
Posted:
Fri Jan 17, 2003 1:29 am
Ok, I'll be back after a good sleep.. at least we're making progress.
_________________ Paul Laudanski, Microsoft MVP Windows-Security
CastleCops: [de] [en] [wiki]
IACOJ Major
Joined: Jan 15, 2003
Posts: 1269
Location: USA
Posted:
Fri Jan 17, 2003 1:39 am
I know I'm playing with it now I should go to bed.
I've slightly mod'd it so the "Your Theme didn't show up at the top of the page. I think I'll leave it for the night or I wont get any sleep at all.
Too excited at at the thought of progress [/code]
mikem Theme Guru
Joined: Jan 13, 2003
Posts: 1582
Location: Corn fields of Indiana
Posted:
Fri Jan 17, 2003 7:04 am
IACOJ wrote:
I know I'm playing with it now I should go to bed.
I've slightly mod'd it so the "Your Theme didn't show up at the top of the page. I think I'll leave it for the night or I wont get any sleep at all.
Too excited at at the thought of progress [/code]
You figure it out yet..or do I need to tell you?..hehe. I ain't tellin'
just kidding. We've fought with this too as you know IACOJ...you fix it you get big happy face from me <=that's justa small one
I also tried the idea of using the Your Account calls for the Selected theme and move it to the block, but never could get it to work.
Oh and when you WERE getting that parse error, that is usually when you pasted the code, you got an extra { or} or maybe a $ somewhere in there...
mikem
IACOJ Major
Joined: Jan 15, 2003
Posts: 1269
Location: USA
Posted:
Fri Jan 17, 2003 8:18 am
Mikem,
Hi
Yes it's making me crazy, we WILL find a solution.
IACOJ Major
Joined: Jan 15, 2003
Posts: 1269
Location: USA
Posted:
Fri Jan 17, 2003 10:49 am
I've been playing with it, I got the forum to show up using an sql query, it's still not showing in the right color, I thought maybe if it was pulled in through sql it would default. Maybe it is just something with my test site, I don't know.
$result3 = sql_query("SELECT uname, uid FROM ".$prefix."_users where uid='$topic_poster'", $dbi);
list($uname, $uid)=sql_fetch_row($result3, $dbi);
$avtor=$uname;
$sifra=$uid;
$result4 = 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'", $dbi);
list($poster_id, $post_time)=sql_fetch_row($result4, $dbi);
$result5 = sql_query("SELECT uname, uid FROM ".$prefix."_users where uid='$poster_id'", $dbi);
list($uname, $uid)=sql_fetch_row($result5, $dbi);
The forum block is showing up in a cross between emerald and fiblack Funny considering I don't have emerald on my test site. You can see it here
Edit I think I know what the problem is, I just don't know where to look in the tables to fix it. The image files aren't being imported with the sql query. Anyone know where to look for that?
Zhen-Xjell Nuke Cops Founder
Joined: Nov 14, 2002
Posts: 5939
Posted:
Fri Jan 17, 2003 10:59 am
Can you upload your block script to the site so that I can play with it on the server?
_________________ Paul Laudanski, Microsoft MVP Windows-Security
CastleCops: [de] [en] [wiki]
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