You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 65 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - automatic theme recognition, in forum block [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
IACOJ
Major
Major


Joined: Jan 15, 2003
Posts: 1269

Location: USA

PostPosted: Wed Jan 15, 2003 3:24 pm Reply with quoteBack to top

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?
Find all posts by IACOJView user's profileSend private message
ArtificialIntel



Joined: Jan 31, 2004
Posts: -88


PostPosted: Wed Jan 15, 2003 3:30 pm Reply with quoteBack to top

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
Find all posts by ArtificialIntelView user's profileSend private message
chatserv
General
General


Joined: Jan 12, 2003
Posts: 3128

Location: Puerto Rico

PostPosted: Wed Jan 15, 2003 3:38 pm Reply with quoteBack to top

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
Find all posts by chatservView user's profileSend private messageVisit poster's website
Zhen-Xjell
Nuke Cops Founder
Nuke Cops Founder


Joined: Nov 14, 2002
Posts: 5939


PostPosted: Wed Jan 15, 2003 3:51 pm Reply with quoteBack to top

Or you can take a look at the Your_Account code for changing a theme... the users default theme shows up first:

http://www.computercops.biz/modules.php?name=Your_Account&op=chgtheme

As an example.

_________________
Paul Laudanski, Microsoft MVP Windows-Security
CastleCops: [de] [en] [wiki]
Find all posts by Zhen-XjellView user's profileSend private messageSend e-mailVisit poster's website
IACOJ
Guest






PostPosted: Wed Jan 15, 2003 5:58 pm Reply with quoteBack to top

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. ?>
Find all posts by Anonymous
chatserv
General
General


Joined: Jan 12, 2003
Posts: 3128

Location: Puerto Rico

PostPosted: Wed Jan 15, 2003 6:18 pm Reply with quoteBack to top

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
Find all posts by chatservView user's profileSend private messageVisit poster's website
IACOJ
Major
Major


Joined: Jan 15, 2003
Posts: 1269

Location: USA

PostPosted: Thu Jan 16, 2003 11:47 pm Reply with quoteBack to top

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.

Code:
$result = sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC", $dbi );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result, $dbi ) )

{
   $skip_display = 0;
   if( $HideViewReadOnly == 1 )
   {
      $result1 = sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'", $dbi );
      list( $auth_view, $auth_read ) = sql_fetch_row( $result1, $dbi );
      if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
   }

   if( $topic_moved_id != 0 )
   {
     // Shadow Topic !!
      $skip_display = 1;
   }
   
   if( $skip_display == 0 )
   {
     $Count_Topics += 1;

$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.

Thanks, and sorry for the long post
Find all posts by IACOJView user's profileSend private message
Zhen-Xjell
Nuke Cops Founder
Nuke Cops Founder


Joined: Nov 14, 2002
Posts: 5939


PostPosted: Fri Jan 17, 2003 12:27 am Reply with quoteBack to top

Try this code, its a slight change from the one I'm working on at http://computercops.biz:

Code:
    $handle=opendir('themes');
    while ($file = readdir($handle)) {
        if ( (!ereg("[.]",$file)) ) {
                $themelist .= "$file ";
        }
    }
    closedir($handle);
    $themelist = explode(" ", $themelist);
    sort($themelist);
    echo "Your Theme:";
    for ($i=0; $i < sizeof($themelist); $i++) {
        if($themelist[$i]!="") {
            if((($chng_theme=="") && ($themelist[$i]=="$Default_Theme")) || ($chng_theme==$themelist[$i])) echo "$themelist[$i]\n";
        }
    }
Don't forget to set $Default_Theme as a global.

_________________
Paul Laudanski, Microsoft MVP Windows-Security
CastleCops: [de] [en] [wiki]
Find all posts by Zhen-XjellView user's profileSend private messageSend e-mailVisit poster's website
IACOJ
Major
Major


Joined: Jan 15, 2003
Posts: 1269

Location: USA

PostPosted: Fri Jan 17, 2003 1:25 am Reply with quoteBack to top

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"
Find all posts by IACOJView user's profileSend private message
Zhen-Xjell
Nuke Cops Founder
Nuke Cops Founder


Joined: Nov 14, 2002
Posts: 5939


PostPosted: Fri Jan 17, 2003 1:29 am Reply with quoteBack to top

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]
Find all posts by Zhen-XjellView user's profileSend private messageSend e-mailVisit poster's website
IACOJ
Major
Major


Joined: Jan 15, 2003
Posts: 1269

Location: USA

PostPosted: Fri Jan 17, 2003 1:39 am Reply with quoteBack to top

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 Very Happy[/code]
Find all posts by IACOJView user's profileSend private message
mikem
Theme Guru
Theme Guru


Joined: Jan 13, 2003
Posts: 1582

Location: Corn fields of Indiana

PostPosted: Fri Jan 17, 2003 7:04 am Reply with quoteBack to top

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 Very Happy[/code]


You figure it out yet..or do I need to tell you?..hehe. I ain't tellin'
Smile
just kidding. We've fought with this too as you know IACOJ...you fix it you get big happy face from me Smile <=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... Confused

mikem
Find all posts by mikemView user's profileSend private message
IACOJ
Major
Major


Joined: Jan 15, 2003
Posts: 1269

Location: USA

PostPosted: Fri Jan 17, 2003 8:18 am Reply with quoteBack to top

Mikem,

Hi Very Happy

Yes it's making me crazy, we WILL find a solution.
Find all posts by IACOJView user's profileSend private message
IACOJ
Major
Major


Joined: Jan 15, 2003
Posts: 1269

Location: USA

PostPosted: Fri Jan 17, 2003 10:49 am Reply with quoteBack to top

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.

Code:
$result = sql_query( "SELECT themes_id, template_name, style_name, head_stylesheet FROM ".$prefix."_bbthemes where themes_id = '$themes_id'", $dbi );
list( $themes_id, $template_name, $style_name, $head_stylesheet ) = sql_fetch_row( $result, $dbi );

$result1 = sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC", $dbi );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result1, $dbi ) )

{
   $skip_display = 0;
   if( $HideViewReadOnly == 1 )
   {
      $result2 = sql_query( "SELECT forum_id, cat_id, forum_name, forum_status, auth_view, auth_read, auth_post,auth_reply FROM ".$prefix."_bbforums where forum_id = '$forum_id'", $dbi );
      list( $forum_id, $cat_id, $forum_name, $forum_status,$auth_view, $auth_read, $auth_post,$auth_reply ) = sql_fetch_row( $result2, $dbi );
      if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
   }

   if( $topic_moved_id != 0 )
   {
     // Shadow Topic !!
      $skip_display = 1;
   }
   
   if( $skip_display == 0 )
   {
     $Count_Topics += 1;


$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 Confused 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?
Find all posts by IACOJView user's profileSend private message
Zhen-Xjell
Nuke Cops Founder
Nuke Cops Founder


Joined: Nov 14, 2002
Posts: 5939


PostPosted: Fri Jan 17, 2003 10:59 am Reply with quoteBack to top

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]
Find all posts by Zhen-XjellView user's profileSend private messageSend e-mailVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next 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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.395 Seconds - 322 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::