PDA

View Full Version : This is impossible >.>


Koutaru
07-19-2004, 02:44 AM
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

<?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

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

Zachery
07-19-2004, 05:31 AM
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

<?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

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 ;)

Koutaru
07-20-2004, 05:36 AM
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?

Zachery
07-20-2004, 07:04 AM
^^; 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.

Koutaru
07-21-2004, 02:32 AM
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] ^^;

Modin
07-21-2004, 02:59 AM
can you post the code where your conditionals are?

Koutaru
07-21-2004, 03:25 AM
Sure ^^; it's in my header and navbar templates. If it looks messy, forgive me
header

<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 :/