Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-17-2010, 03:56 AM
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Wondering about the stability of vb4

Been seeing some behavior that is beginning to scare me. Successfully added numerous custom pages via Lynn's instructions. 1 creat template 2. create php file. 3 Point php file at template. 4 Create plugin with included reference. 5 Add include reference to body of template file (and sometimes a second plugin for the head).

Everything was going great until my 5th or 6th new page when I started seeing behavior that made no sense. I followed the same exact procedures as I had for the previous pages yet the new page would either not come up at all or it would be missing the plugin content. I ended up recreating the plugins, the php file and the template file numerous times with different names then for no apparent reason it started working again. Then tonight I experienced it again. I needed to add a custom page for my terms of use page. This time when I created the custom page whenever I pointed the plugin to the template file it would kill my forums and CMS. Finally after 8 or 9 tries with different file names it worked using the same file names and included numbers as I started with.

As I am about to go live next week this behavior is making me very nervous. Has anybody else experienced this behavior?
Reply With Quote
  #2  
Old 06-17-2010, 04:16 AM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have plenty of "custom pages" with no problems whatsoever. Can you post a sample of one page to make sure? When this happens again, disable the plugins globally (you dont need them to render the custom pages), does it still work?
Reply With Quote
  #3  
Old 06-17-2010, 04:53 AM
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DragonBlade View Post
I have plenty of "custom pages" with no problems whatsoever. Can you post a sample of one page to make sure? When this happens again, disable the plugins globally (you dont need them to render the custom pages), does it still work?
Thanks for the reply DragonBlade.

I first saw this behavior 3 weeks ago. I had added like 8 or 9 custom pages with now issues at all. Then when I needed add my 10th page it wouldn't work. I was ready to pull my hair out as when creating new custom pages I just use the previous files (plugin code, php file, template file and the php files that are called by the plugins) as templates and just give them new names and rename where appropriate in files, increment the phpincluded number, etc. I created the new page and the thing either would not come up at all or it would be missing the plugin generated content. After renaming and recreating all the files (template, plugins, php file etc) it suddenly worked. What freaked me it is that it made no sense why it worked as I had created the files exactly as before. It was like for two hours 2 + 2 no longer equaled 4. At the time I managed to convince myself that I must have been doing something goofy. After that everything was stable.

Then tonight it happened again. But this time the page would come up missing the content and it killed my cms and forum pages. This really freaked me out. For a period of time just creating and activating the plugin would kill my CMS and formum. Then after that I could creat and activate the plugin but the minute I specifed the new template file name it would kill the CMS and forum. Same drill as last time recreated all files, new names etc. After an hour it worked with the same combination of file names that I started with. Needless to say I am not feeling super confident.

I was wondering if some background maintenance task was causing this issue.

Any feedback would be appreciated.

See below for examples of Template, plugin code, and php template:

Template file-----------------------------------------------------------------------------------------------

{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar

textdirection}" lang="{vb:stylevar languagecode}"

id="vbulletin_html">
<head>
<script type="text/javascript" src="lookup.js"></script>

<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}


</head>
<body>



{vb:raw header}



{vb:raw navbar}


{vb:raw $includedphp31}



{vb:raw footer}
</body>
</html>

Plugin code------------------------------------------------------------------------------------------
ob_start();
include('termsbody.php');
$includedphp31 = ob_get_contents();
ob_end_clean();
vB_Template:reRegister('terms',array('includedph p31' => $includedphp31));

set for global start and execution order of 5, 6 or 7

PHP template---------------------------------------------------------------------------------------------------------

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT', 'home');
define('CSRF_PROTECTION', true);
// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

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

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

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

// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the
next line
// chdir ('/path/to/your/forums');
require_once('./global.php');



// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################






$navbits = construct_navbits(array('' => 'Terms'));

$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Terms and Conditions';

// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######





$templater = vB_Template::create('terms');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());

?>


Php file----------------------------------------------------------------------------------

standard code. Sometimes PHP and HTML or other times just HTML.


Is there a limit to the number of plugins\custom pages?
Reply With Quote
  #4  
Old 06-17-2010, 05:08 AM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Read this (your plugin code isnt necessary at all I believe):
https://vborg.vbsupport.ru/showthread.php?t=228112
Reply With Quote
  #5  
Old 06-17-2010, 05:29 AM
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes this is the article I followed the create the new page. Of course that just generates an empty page with the header and footer. I followed some other instructions here If forget where on how to get your PHP content into the page. In order to do that I had to create the plugin that references the php code that feeds it into the template file. As you can't just enter PHP code directly into the template file.

Is there a better way to feed in PHP code into a custom page?

I was browsing the forums just now when I came upon the post below dated 2-10-2010:

Marco van Herwaarden Marco van Herwaarden is offline
vBulletin.org Coordinator

Join Date: Jul 2004
Posts: 25,556
Design: Blue Lagoon,Fixed
You can not usxe PHP in a template. You will need to use a plugin, assign the output of the PHP to a variable and use that in your template.
__________________
Marco van Herwaarden
vBulletin.org Coordinator



http://www.vbulletin.com/docs/html/t..._externalfiles

I think I'm doing this correctly.....
Reply With Quote
  #6  
Old 06-17-2010, 06:13 AM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah I see. This should help alot:
https://vborg.vbsupport.ru/showthread.php?t=228078

If you dont understand, feel free to ask and I'll gladly help
Reply With Quote
  #7  
Old 06-17-2010, 06:45 AM
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DragonBlade View Post
Ah I see. This should help alot:
https://vborg.vbsupport.ru/showthread.php?t=228078

If you dont understand, feel free to ask and I'll gladly help
Dragonblade,

I read this thread a month ago when I was first trying to figure out how to get all my php code into my custom pages. It didn't make much sense back then. It makes a little more sense now. I was planning on going live with my site next week. I assume the Plugin method I chose is ok for now.

I would like to understand the method in that thread though and if it makes sense I will redo my custom pages later when I have a more firm understanding of how to implement what the thread describes

"Now, with the result of the rendering we can do several things:
.
Output template directly - custom pages

So I'm trying to understand the post in that thread. So I have lots of pages of php + html. Its basically a complete php app. So with the plugin method I am assigning a variable to an entire page of php\html content and then placing that variable in the VB template (the one found via edit > templates).

In the article I am I doing something similar right? IE assigning a variable to a page of php\html?

I'm reading the passage below and trying to figure out exactly how my custom code gets assigned to a variable.
The code in each of my php pages is unique.

PHP Code:
$templater = vB_Template::create('mytemplate');
$templater->register_page_templates();
$templater->register('my_var', $my_var);
$templater->register('my_array', $my_array);
print_output($templater->render());
This immediatly outputs the template. Use this if you have created your own page, for example.
Note the second line, which is special for this type of use:

I'm a bit of a beginner when it comes to PHP coding.
"
/* Some Code, setting variables, (multidimensional) array */
$my_var = "abc";"

so they are defining the value of $my_var as "abc" ok so how to I set a variable to my php code. Would it be $my_var = "mycustomphp.php" ??

So using my 2 template examples above (what goes where using this method to output the contents of termsbody.php??
Reply With Quote
  #8  
Old 06-17-2010, 08:04 AM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm only an amateur as well :P

It depends on how you want to output it. Generally, I put the HTML within the templates but using it in PHP is fine as well. You just bind your entire php+html output into 1 variable, lets say $output. This does not mean $output = mycustomphp.php; btw.

Then put this at the end of your php code:
PHP Code:
$navbits construct_navbits(array('' => 'Your Page'));
$navbar render_navbar_template($navbits);

$templater vB_Template::create('yourtemplatehere'); //replace with your template
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('output'$output);
print_output($templater->render()); 
Now in your templates, yourtemplatehere, it should be something like this if you follow the tutorial but with your output variable:
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} - {vb:raw pagetitle}</title>
    {vb:raw headinclude}
    {vb:raw headinclude_bottom}
  </head>
  <body>
    
    {vb:raw header}
    
    {vb:raw navbar}
    
    <div id="pagetitle">
      <h1>{vb:raw pagetitle}</h1>
    </div>
    
    <h2 class="blockhead">Title</h2>
    <div class="blockbody">
      <div class="blockrow">
        {vb:raw output}
      </div>
    </div>
    
    {vb:raw footer}
  </body>
</html>
No plugin necessary unless you want the Who Online List thingy.
Reply With Quote
  #9  
Old 06-17-2010, 08:31 AM
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DragonBlade View Post
I'm only an amateur as well :P

It depends on how you want to output it. Generally, I put the HTML within the templates but using it in PHP is fine as well. You just bind your entire php+html output into 1 variable, lets say $output. This does not mean $output = mycustomphp.php; btw.

Then put this at the end of your php code:
PHP Code:
$navbits construct_navbits(array('' => 'Your Page'));
$navbar render_navbar_template($navbits);

$templater vB_Template::create('yourtemplatehere'); //replace with your template
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('output'$output);
print_output($templater->render()); 
Now in your templates, yourtemplatehere, it should be something like this if you follow the tutorial but with your output variable:
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} - {vb:raw pagetitle}</title>
    {vb:raw headinclude}
    {vb:raw headinclude_bottom}
  </head>
  <body>
    
    {vb:raw header}
    
    {vb:raw navbar}
    
    <div id="pagetitle">
      <h1>{vb:raw pagetitle}</h1>
    </div>
    
    <h2 class="blockhead">Title</h2>
    <div class="blockbody">
      <div class="blockrow">
        {vb:raw output}
      </div>
    </div>
    
    {vb:raw footer}
  </body>
</html>
No plugin necessary unless you want the Who Online List thingy.

You just bind your entire php+html output into 1 variable, lets say $output.

Dragonblade,

please excuse my ignorance but how to I bind my php and html code into a variable? With the plugin method I specified the php page where all my code resides. How do I do it here? Where do I put my php/html code?
Reply With Quote
  #10  
Old 06-17-2010, 08:37 AM
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just to make sure, do you echo your html+PHP since you are using the include function before?
Reply With Quote
Reply


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 07:34 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.06748 seconds
  • Memory Usage 2,296KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete