vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Create your own vBulletin page (https://vborg.vbsupport.ru/showthread.php?t=228112)

Lynne 11-18-2009 05:58 PM

Quote:

Originally Posted by Steve M (Post 1916417)
Ok next question, I am reusing the same variable for different pages so I am not having a cluster of different variables within conditional statements. Right now it seems that is confusing me or its the meds, either way is it safe to say I can keep doing that or should I change it?

PHP Code:

$templater->register('display'$display); 

That var is what I am reusing for each page load of do=cat or do=file, etc. Do I need to change it to print_output or what?

You should be able to use the same variable name on different pages - vb does that alot.

If you are wanting to register that variable on each page for use in the template, you need to put that line inbetween the $templater = vB_Template::create('whatever_template') and the $templater->render() lines.

edit: Or actually, you may be able to just preregister it at the top of you page for the template. See the article I link to in my first post to find out about preregistering variables.

cory_booth 11-18-2009 06:06 PM

Replace the line:
require_one ./gobal

With:
PHP Code:

$curdir getcwd ();
chdir('/yourpath/to/site/public_html/forum');
require_once(
'/yourpath/to/site/public_html/global.php');
chdir ($curdir); 

Will allow you to put the php files anywhere on the site (i.e. mydomain.com/pages/)

LoveStream 11-19-2009 01:02 AM

Quote:

Originally Posted by ragtek (Post 1916684)
Be sure that there's nothing before <?php

Yes, I double checked it but it still remains. I suspect that affected by server programs. When I logged there is no problem. It is only just for guest than member logged.

I create new my.php file. and do define this scripts refer to template files.

Regards.

--------------- Added [DATE]1258599895[/DATE] at [TIME]1258599895[/TIME] ---------------

Quote:

Originally Posted by cory_booth (Post 1916733)
Replace the line:
require_one ./gobal

With:
PHP Code:

$curdir getcwd ();
chdir('/yourpath/to/site/public_html/forum');
require_once(
'/yourpath/to/site/public_html/global.php');
chdir ($curdir); 

Will allow you to put the php files anywhere on the site (i.e. mydomain.com/pages/)

Thanks. I do put it the same path with vB. When I trial as logged it's run very well.

Lynne 11-19-2009 01:10 AM

Quote:

Originally Posted by cory_booth (Post 1916733)
Replace the line:
require_one ./gobal

With:
PHP Code:

$curdir getcwd ();
chdir('/yourpath/to/site/public_html/forum');
require_once(
'/yourpath/to/site/public_html/global.php');
chdir ($curdir); 

Will allow you to put the php files anywhere on the site (i.e. mydomain.com/pages/)

Actually, if you chdir, you don't want to then put the whole path to the global.php file. You would just go:
PHP Code:

$curdir getcwd ();
chdir('/yourpath/to/site/public_html/forum');
require_once(
'./global.php');
chdir ($curdir); 


Mythotical 11-19-2009 02:52 AM

Quote:

Originally Posted by Lynne (Post 1916727)
You should be able to use the same variable name on different pages - vb does that alot.

If you are wanting to register that variable on each page for use in the template, you need to put that line inbetween the $templater = vB_Template::create('whatever_template') and the $templater->render() lines.

edit: Or actually, you may be able to just preregister it at the top of you page for the template. See the article I link to in my first post to find out about preregistering variables.

Good point, I will look into doing that tomorrow. Need sleep first.

ragtek 11-19-2009 09:14 AM

What's with
PHP Code:

require_once(DIR '/includes/class_bootstrap_framework.php');
vB_Bootstrap_Framework::init(); 

Do we need it?
Some files in vB4 have it^^

Lynne 11-19-2009 01:41 PM

You may need to add those lines depending on what you do in your code. But, every page doesn't need those lines. I *think*, but I'm not positive, that if you have hooks in your page, you will want to include those lines. But, since usually there aren't any hooks added into a custom page, then those lines aren't needed.

EidolonAH 11-21-2009 12:14 PM

Brilliant, thank you Lynne.:up:

Anseur 11-21-2009 04:05 PM

I've set this up on my test site, and it works OK while i'm logged in, but when I'm not logged in, and I visit this custom page, I just get a plain white screen.

looking at a source of this plain white pages shows me:
Code:

<!-- BEGIN TEMPLATE: dkp_template -->
 
<!-- END TEMPLATE: dkp_template -->

Here is the code currently used in the template for this custom .php page:

Code:

{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
  <head>
    <title>{vb:raw vboptions.bbtitle}</title>
    {vb:raw headinclude}
  </head>
  <body>
   
    {vb:raw header}
   
    {vb:raw navbar}
   
    <div id="pagetitle">
      <h1>{vb:raw pagetitle}</h1>
    </div>
  <li class="popupmenu">
    <h2 class="blockhead">The MCO DKP System</h2>
    <h2 class="blocksubhead"> <vb:if condition="$show['modcplink']">
                                <a href="javascript://" class="popupctrl">Administration</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="/25manwrathplus/admin/" target=”dkp_frame”>Admin Index</a></li>
                                        <li><a href="sublink2.php">SubLink 2</a></li>
                                        <li><a href="sublink3.php">SubLink 3</a></li>
                                </ul>
                            </li>
</vb:if> </h2>
                         
    <div class="blockbody">
      <div {height:auto;}>

<iframe name="dkp_frame" width=100% height=1700px SCROLLING=no FRAMEBORDER=0 src="/25manwrathplus">dkp_frame</iframe>
               
      </div>
    </div>
   
    {vb:raw footer}
  </body>
</html>


Lynne 11-21-2009 04:34 PM

Quote:

Originally Posted by Anseur (Post 1918381)
I've set this up on my test site, and it works OK while i'm logged in, but when I'm not logged in, and I visit this custom page, I just get a plain white screen.

looking at a source of this plain white pages shows me:
[code]
<!-- BEGIN TEMPLATE: dkp_template -->

<!-- END TEMPLATE: dkp_template -->

What is in your error_logs? (If you don't know where they are, ask your host.) What is in your php page that you created?


All times are GMT. The time now is 06:12 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.01412 seconds
  • Memory Usage 1,764KB
  • 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
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete