View Single Post
  #7  
Old 06-04-2002, 07:32 AM
version's Avatar
version version is offline
 
Join Date: Nov 2001
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ixian, the phpinclude template is always parsed, even for the front page of the site, if you include("$forumpath/global.php").

here's the chatstuff in my phpinclude template:
PHP Code:
if ($bbuserinfo[userid] != "0") {
  
$chatname str_replace(" ""%20"$bbuserinfo[username]);
  
$chatpass $bbuserinfo[password];

  
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL");
  
mysql_select_db($dbname) or die("Can't select database");

  
mysql_query("DELETE from chat_users where u_time < ".(time() - 240)." and u_time > 0");
  
$num_chatters_query mysql_query("SELECT DISTINCT username FROM chat_users WHERE room != \"PRIVATE_ROOM\"");
  
$num_chatters mysql_num_rows($num_chatters_query);

  if (
$num_chatters == "0") {
    
$chatextra "";
  } elseif (
$num_chatters == "1") {
    
$chatextra "(1 user)";
    
$istext "is";
    
$membertext "member";
  } else {
    
$chatextra "($num_chatters users)";
    
$istext "are";
    
$membertext "members";
  }

  
$who_chatters_query mysql_query("SELECT DISTINCT username FROM chat_users");

  while (
$chatters mysql_fetch_array($who_chatters_query)) {
    
$who_chatters .= "&nbsp;$chatters[username]&nbsp;";
  }
  
  eval(
"\$chatinfo = \"".gettemplate("forumhome_chatinfo")."\";"); 

also in my phpinclude, specifically the bit that builds the dynamic menu:
PHP Code:
ob_start();
  
$pan = new Panel();
  
$pan->addPanel"1""General""$forumpath/menu_general.php" );
  
$pan->addPanel"2""Help""$forumpath/menu_help.php" );  
  if (
$bbuserinfo[userid] != "0") {
    
$pan->addPanel"3""User""$forumpath/menu_user.php" );
    
$pan->addPanel"4""Chat $chatextra""$baseurl/forums/menu_chat.php?username=$chatname&password=$chatpass);
    
$pan->addPanel"5""Misc.""$baseurl/forums/menu_misc.php?username=$chatname&password=$chatpass&userid=$bbuserinfo[userid]);
    if (
$bbuserinfo[usergroupid] == "6") {
      
$pan->addPanel"6""Moderator""$baseurl/forums/menu_mod.php?username=$chatname&password=$chatpass);
      
$pan->addPanel"7""Administrator""$baseurl/forums/menu_admin.php?username=$chatname&password=$chatpass);
       
$pan->addPanel"8""Test""$baseurl/forums/menu_test.php?username=$chatname&password=$chatpass&userid=$bbuserinfo[userid]);
     }
    if (
$bbuserinfo[usergroupid] == "7" || $bbuserinfo[usergroupid] == "5") {
      
$pan->addPanel"6""Moderator""$baseurl/forums/menu_mod.php?username=$chatname&password=$chatpass);
      
$pan->addPanel"7""Test""$baseurl/forums/menu_test.php?username=$chatname&password=$chatpass&userid=$bbuserinfo[userid]);
     }
  }
  
$pan->Display(); 
  
$menucontents ob_get_contents();
ob_end_clean(); 
as you can see, i pass variables to my subscripts variables in the URLs, i.e. $chatname as $username, $bbuserinfo[userid] as $userid.

here is the contents of the "menu_chat.php" script mentioned above:
PHP Code:
print "<a href=\"/chat/index.php3?U=$username&PWD_Hash=$password&Ver=H&L=english&R0=General&T=1&D=10&N=200&EN=1\">General Chat</a><br>
 <a href=\"/chat/index.php3?U=
$username&PWD_Hash=$password&Ver=H&L=english&R0=Poetry+Slam&T=1&D=10&N=200&EN=1\">Poetry Slam</a><br>"
i am also attaching the template for the forumhome_chatinfo. let me know if there is more questions, and if someone wants to add more (or better) instructions to my package, send me the changes and i will give you credit. (busy life right now, got twins on the way )
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01135 seconds
  • Memory Usage 1,820KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete