Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 07-19-2004, 02:44 AM
Koutaru's Avatar
Koutaru Koutaru is offline
 
Join Date: Feb 2003
Location: IL
Posts: 589
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default This is impossible >.>

Okay, I've tried everything I can think of besides full integration which would eventually kill me but nothing works out :surprised:

What I'm trying to do is include my header and footer templates into another script (4images inf you're interested) Since I have important conditional statements, this requires the vbulletin conditionals

What I've done:

1. Put
Code:
<?php

// # Set up php error reporting... 
error_reporting(E_ALL & ~E_NOTICE); 

// # Define important var's 
define('NO_REGISTER_GLOBALS', 1); 
// name of script 
define('THIS_SCRIPT', 'script'); 
// allows us to use custom templates in this script 
define('GET_EDIT_TEMPLATES', true); 

// # Cache templates 
// get special phrase groups 
$phrasegroups = array(); 

// get special data templates from the datastore 
$specialtemplates = array(); 

// pre-cache templates used by all actions 
$globaltemplates = array( 
                ''
                        ); 

// pre-cache templates used by specific actions 
$actiontemplates = array(); 

// # Get backend... 
chdir("/home/miyechi/public_html/");
require_once('./global.php'); 

// $template output's customtemplate1 
eval('$headerinclude = "' . fetch_template('headerinclude') . '";'); 
eval('$header = "' . fetch_template('header') . '";'); 
eval('$navbar = "' . fetch_template('navbar') . '";'); 

// output's custometemplate2 (main template) 
eval('print_output("' . fetch_template('headergeneral') . '");'); 
?>
2. In headergeneral, a custom vb template, I have the variables $header, $headerinclude, and $navbar

3. I go to REQUIRE this new file in the header of the gallery script
Code:
require("http://www.miyechi.com/includes/header.php");
It works fine.
Except the HUGE fact that the conditionals aren't working! The conditionals seem to be setting place before the userinfo is even outputed. So frustrating

Anyone can shed a light onto this I know this is the lazy way to do it and I'm not exactly a php guru
Reply With Quote
  #2  
Old 07-19-2004, 05:31 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Koutaru
Okay, I've tried everything I can think of besides full integration which would eventually kill me but nothing works out :surprised:

What I'm trying to do is include my header and footer templates into another script (4images inf you're interested) Since I have important conditional statements, this requires the vbulletin conditionals

What I've done:

1. Put
Code:
<?php

// # Set up php error reporting... 
error_reporting(E_ALL & ~E_NOTICE); 

// # Define important var's 
define('NO_REGISTER_GLOBALS', 1); 
// name of script 
define('THIS_SCRIPT', 'script'); 
// allows us to use custom templates in this script 
define('GET_EDIT_TEMPLATES', true); 

// # Cache templates 
// get special phrase groups 
$phrasegroups = array(); 

// get special data templates from the datastore 
$specialtemplates = array(); 

// pre-cache templates used by all actions 
$globaltemplates = array( 
                ''
                        ); 

// pre-cache templates used by specific actions 
$actiontemplates = array(); 

// # Get backend... 
chdir("/home/miyechi/public_html/");
require_once('./global.php'); 

// $template output's customtemplate1 
eval('$headerinclude = "' . fetch_template('headerinclude') . '";'); 
eval('$header = "' . fetch_template('header') . '";'); 
eval('$navbar = "' . fetch_template('navbar') . '";'); 

// output's custometemplate2 (main template) 
eval('print_output("' . fetch_template('headergeneral') . '");'); 
?>
2. In headergeneral, a custom vb template, I have the variables $header, $headerinclude, and $navbar

3. I go to REQUIRE this new file in the header of the gallery script
Code:
require("http://www.miyechi.com/includes/header.php");
It works fine.
Except the HUGE fact that the conditionals aren't working! The conditionals seem to be setting place before the userinfo is even outputed. So frustrating

Anyone can shed a light onto this I know this is the lazy way to do it and I'm not exactly a php guru
well you dont need to redefine header fyi, it is a global varible, so you can remove that one. I thjink that headinclude is as well, not to mention the template is headinclude not header include
Reply With Quote
  #3  
Old 07-20-2004, 05:36 AM
Koutaru's Avatar
Koutaru Koutaru is offline
 
Join Date: Feb 2003
Location: IL
Posts: 589
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery
well you dont need to redefine header fyi, it is a global varible, so you can remove that one. I thjink that headinclude is as well, not to mention the template is headinclude not header include
^^; thanks for noticing my glitches. I'll fix them.

The main problem is, how do I make the require use the user info instead of just assuming the user is a guest?
Reply With Quote
  #4  
Old 07-20-2004, 07:04 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Koutaru
^^; thanks for noticing my glitches. I'll fix them.

The main problem is, how do I make the require use the user info instead of just assuming the user is a guest?
To be honest i havent done much with outside scripts unless it was fully intergrated :\ sorry.
Reply With Quote
  #5  
Old 07-21-2004, 02:32 AM
Koutaru's Avatar
Koutaru Koutaru is offline
 
Join Date: Feb 2003
Location: IL
Posts: 589
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery
To be honest i havent done much with outside scripts unless it was fully intergrated :\ sorry.
It's alright, if I'm desparate (and I'm starting to be) I might just code my own [coughdisastercough] ^^;
Reply With Quote
  #6  
Old 07-21-2004, 02:59 AM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can you post the code where your conditionals are?
Reply With Quote
  #7  
Old 07-21-2004, 03:25 AM
Koutaru's Avatar
Koutaru Koutaru is offline
 
Join Date: Feb 2003
Location: IL
Posts: 589
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sure ^^; it's in my header and navbar templates. If it looks messy, forgive me
header
Code:
<if condition="$avatarurl && !$show['guest']"><img src="$avatarurl" border="0"><else /><img src="http://images.miyechi.com/avatar/noavatar.gif" border="0"></if></a>



 <!-- breadcrumb, login, pm info -->
	<if condition="$bbuserinfo['userid']">
		<td valign="top" nowrap="nowrap">
		<div class="smallfont">
			<span style="float:$stylevar[right]">
			<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br>
			<if condition="$show['pmstats']"><phrase 1="$vbphrase[unread_x_nav_compiled]" 2="$vbphrase[total_x_nav_compiled]" 3="$session[sessionurl]">$vbphrase[private_messages_nav]</phrase></if><br>
[<a href="http://www.miyechi.com/login.php?$session[sessionurl]do=logout&amp;u=$bbuserinfo[userid]" onclick="return log_out()">$vbphrase[log_out]</a>]</span>
		</div>
		</td>
		
	<else />
		
		<td nowrap="nowrap" style="padding:0px">
			
		<!-- login form -->
		<form action="http://www.miyechi.com/login.php" method="post" onsubmit="md5hash(vb_login_password,vb_login_md5password)">
		<script type="text/javascript" src="clientscript/vbulletin_md5.js"></script>
		<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
		<tr>
			<td><input type="text" class="button" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="1" value="$vbphrase[username]" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td>
			<td class="smallfont" colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="3" id="cb_cookieuser_navbar" accesskey="c" checked="checked" />$vbphrase[remember_me]</label></td>
		</tr>
		<tr>
			<td><input type="password" class="button" name="vb_login_password" value="$vbphrase[password]" size="10" accesskey="p" tabindex="2" onfocus="if (this.value == '$vbphrase[password]') this.value = '';" /></td>
			<td><input type="submit" class="button" value="$vbphrase[log_in]" tabindex="4" title="$vbphrase[enter_username_to_login_or_register]" accesskey="s" /></td>
		</tr>
		</table>
		<input type="hidden" name="s" value="$session[sessionhash]" />
		<input type="hidden" name="do" value="login" />
		<input type="hidden" name="forceredirect" value="1" />			
		<input type="hidden" name="vb_login_md5password" />
		</form>
		<!-- / login form -->
		</td>
	</if>	
<!-- / breadcrumb, login, pm info -->
You can see it in action here:
http://www.miyechi.com/forum.php

It's just trying to distinct between registered users and guests basically :/
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:29 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04169 seconds
  • Memory Usage 2,236KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete