vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   This is impossible >.> (https://vborg.vbsupport.ru/showthread.php?t=67357)

Koutaru 07-19-2004 01:44 AM

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

Zachery 07-19-2004 04:31 AM

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

Koutaru 07-20-2004 04:36 AM

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?

Zachery 07-20-2004 06:04 AM

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.

Koutaru 07-21-2004 01:32 AM

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] ^^;

Modin 07-21-2004 01:59 AM

can you post the code where your conditionals are?

Koutaru 07-21-2004 02:25 AM

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


All times are GMT. The time now is 10:43 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01694 seconds
  • Memory Usage 1,750KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete