Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 17 Jun 2010, 05:56
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
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?

Last edited by Kyle55155; 17 Jun 2010 at 06:06.
Reply With Quote
  #2  
Old 17 Jun 2010, 06:16
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
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?
__________________
Anime Arcadia - Anime, Video Games, & Music Forums
Reply With Quote
  #3  
Old 17 Jun 2010, 06:53
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
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('includedphp31' => $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?

Last edited by Kyle55155; 17 Jun 2010 at 07:15.
Reply With Quote
  #4  
Old 17 Jun 2010, 07:08
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Read this (your plugin code isnt necessary at all I believe):
http://www.vbulletin.org/forum/showthread.php?t=228112
__________________
Anime Arcadia - Anime, Video Games, & Music Forums
Reply With Quote
  #5  
Old 17 Jun 2010, 07:29
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
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.....

Last edited by Kyle55155; 17 Jun 2010 at 08:01.
Reply With Quote
  #6  
Old 17 Jun 2010, 08:13
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Ah I see. This should help alot:
http://www.vbulletin.org/forum/showthread.php?t=228078

If you dont understand, feel free to ask and I'll gladly help
__________________
Anime Arcadia - Anime, Video Games, & Music Forums
Reply With Quote
  #7  
Old 17 Jun 2010, 08:45
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
Originally Posted by DragonBlade View Post
Ah I see. This should help alot:
http://www.vbulletin.org/forum/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??

Last edited by Kyle55155; 17 Jun 2010 at 08:58.
Reply With Quote
  #8  
Old 17 Jun 2010, 10:04
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now in your templates, yourtemplatehere, it should be something like this if you follow the tutorial but with your output variable:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

No plugin necessary unless you want the Who Online List thingy.
__________________
Anime Arcadia - Anime, Video Games, & Music Forums
Reply With Quote
  #9  
Old 17 Jun 2010, 10:31
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now in your templates, yourtemplatehere, it should be something like this if you follow the tutorial but with your output variable:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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 17 Jun 2010, 10:37
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
Just to make sure, do you echo your html+PHP since you are using the include function before?
__________________
Anime Arcadia - Anime, Video Games, & Music Forums
Reply With Quote
  #11  
Old 17 Jun 2010, 10:46
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
Originally Posted by DragonBlade View Post
Just to make sure, do you echo your html+PHP since you are using the include function before?
I got that php file from Lynn's article. I just copied it. The only change I made to it was specifiying the template name.

I don't echo my php or html. I just pointed the plugin at my php file and it loads it into the $includedphp variable and then I just add that variable to my template. Are you saying you put PHP code directly into the template file? That's one of the first things I tried and it will not run that way. Or are you saying I need to echo all php\html code in the template.?

I thinking I'm missing something here. Thanks for being patient. My code is for a separate app that resides inside custom vbulletin pages.

Last edited by Kyle55155; 17 Jun 2010 at 10:53.
Reply With Quote
  #12  
Old 17 Jun 2010, 10:53
DragonBlade's Avatar
DragonBlade DragonBlade is offline
 
Join Date: May 2006
If you dont mind, can you PM me your php code? Would simplify things :P
__________________
Anime Arcadia - Anime, Video Games, & Music Forums
Reply With Quote
  #13  
Old 17 Jun 2010, 10:55
Kyle55155 Kyle55155 is offline
 
Join Date: Mar 2010
sure. I have multiple pages. I'll send you one. Give me 5 minutes

--------------- Added 17 Jun 2010 at 11:17 ---------------

Originally Posted by DragonBlade View Post
If you dont mind, can you PM me your php code? Would simplify things :P
Sent. I have hundreds of lines of php and html code. The plugin method seems pretty simple. As I just point the plugin directly at the specific php page. I'm just unclear how I am supposed to make $output (or whatever variable name) = (all the php\html code for a particular php page I have without using a plugin.

It came as a bit of a surprise when I first learned I could not add PHP coded directly into the template files. Plus I read that the custom php code must first be buffered while the Vbulletin code is executed first. I'm unclear how this issue is addressed using the no plugin method.

Last edited by Kyle55155; 17 Jun 2010 at 11:26. Reason: Auto-Merged DoublePost
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 10:40.

Layout Options | Width: Wide Color: