vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Plugin Problem (https://vborg.vbsupport.ru/showthread.php?t=267044)

thunderclap82 07-20-2011 01:15 PM

Quote:

Originally Posted by Lynne (Post 2222703)
But your template doesn't actually look like that unless you left "your URL" and "link to your image file" in there (which you should not have). So, exactly what does your template look like?

Here is the template code:

Code:

<link rel="stylesheet" href="clientscript/nivo-slider.css" type="text/css" media="screen" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="clientscript/jquery.nivo.slider.pack.js" type="text/javascript"></script>

<div id="slider">
<a href="http://www.repairmanjack.com"><img src="http://www.repairmanjack.com/forum/animate_logo/rj_logo00.png" /></a>
<a href="http://www.repairmanjack.com"><img src="http://www.repairmanjack.com/forum/animate_logo/rj_logo01.png" /></a>
<a href="http://www.repairmanjack.com"><img src="http://www.repairmanjack.com/forum/animate_logo/rj_logo02.png" /></a>
<a href="http://www.repairmanjack.com"><img src="http://www.repairmanjack.com/forum/animate_logo/rj_logo00.png" /></a>
<a href="http://www.repairmanjack.com"><img src="http://www.repairmanjack.com/forum/animate_logo/rj_logo03.png" /></a>
<a href="http://www.repairmanjack.com"><img src="http://www.repairmanjack.com/forum/animate_logo/rj_logo04.png" /></a>
<a href="http://www.repairmanjack.com"><img src="http://www.repairmanjack.com/forum/animate_logo/rj_logo00.png" /></a>
<a href="http://www.repairmanjack.com"><img src="http://www.repairmanjack.com/forum/animate_logo/rj_logo05.png" /></a>
<a href="http://www.repairmanjack.com"><img src="http://www.repairmanjack.com/forum/animate_logo/rj_logo.png" /></a>
</div>

<vb:literal>
<script type="text/javascript">
$(window).load(function() {
var total = $('#slider img').length;
var rand = Math.floor(Math.random()*total);
        $('#slider').nivoSlider({
                effect:'random',
                slices:15,
                animSpeed:500,
                pauseTime:7000,
                startSlide:rand,
                directionNav:false,
                directionNavHide:true,
                controlNav:false,
                controlNavThumbs:false,
                controlNavThumbsFromRel:false,
                keyboardNav:true,
                pauseOnHover:true,
                manualAdvance:false,
                captionOpacity:0.8,
                beforeChange: function(){},
                afterChange: function(){},
                slideshowEnd: function(){}
        });
});
</script>
</vb:literal>

I also did an experiment where the plugin called a non-existent template. Not sure if an Internal Server Error would normally cause this, but it did.

kh99 07-20-2011 02:44 PM

I tested to make sure - using a non-existent template should just result in a (more or less) empty string.

If you haven't already, maybe try this code:

PHP Code:

$templatevalues['banner_rotator'] = "Test Banner Rotator";
vB_Template::preRegister('header'$templatevalues); 


I'm not really an expert on these kinds of thing, but based on what I've seen before I'm kind of getting a feeling like it's a problem other than what you're doing, like maybe a php configuration issue or something wrong with the vb installation. Is this a new install of vb? Did you try running "Suspect File Versions" under Maintenance in the adminCP?

thunderclap82 07-20-2011 03:34 PM

Quote:

Originally Posted by kh99 (Post 2222877)
I tested to make sure - using a non-existent template should just result in a (more or less) empty string.

If you haven't already, maybe try this code:

PHP Code:

$templatevalues['banner_rotator'] = "Test Banner Rotator";
vB_Template::preRegister('header'$templatevalues); 


I'm not really an expert on these kinds of thing, but based on what I've seen before I'm kind of getting a feeling like it's a problem other than what you're doing, like maybe a php configuration issue or something wrong with the vb installation. Is this a new install of vb? Did you try running "Suspect File Versions" under Maintenance in the adminCP?

This is an upgrade to vB 4.1.4 from 3.8.4.

I changed the plugin code and that stopped the Internal Server Error. Not sure why
Code:

$templater->render()
was crashing the system, but it seems to have been the cause.

But the images in the slider won't load. Not sure what's up with that, but that's a different problem entirely.

kh99 07-20-2011 03:36 PM

Well, in retrospect I guess that didn't help much since you already knew it was the call to render causing the problem. But taking it out isn't really a fix since you should be able to reder a template there if you want.

thunderclap82 07-20-2011 03:59 PM

Quote:

Originally Posted by kh99 (Post 2222906)
Well, in retrospect I guess that didn't help much since you already knew it was the call to render causing the problem. But taking it out isn't really a fix since you should be able to reder a template there if you want.

Could that rendering command being deleted cause the images not to load? Those are called in the template itself.

Also, should it be
Code:

$template->render()
as opposed to
Code:

$templater->render()
with emphasis on the r in templater?

Lynne 07-20-2011 04:24 PM

$templater->render() is correct since that is what he defined.

Try this for preregistering:

Code:

vB_Template::preRegister('header', array('templatevalues' => $templatevalues));
And did you already define $templatevalues as an array somewhere?

Lynne 07-20-2011 04:43 PM

Also, is it *any* template you render via a plugin on that site that causes issues, or just this one? If it is any template, then I would suspect something like mod_security or suhosin to be the problem. Have you run diagnostics > problematic webserver modules?

thunderclap82 07-20-2011 05:47 PM

Quote:

Originally Posted by Lynne (Post 2222917)
Try this for preregistering:

Code:

vB_Template::preRegister('header', array('templatevalues' => $templatevalues));
And did you already define $templatevalues as an array somewhere?

I added that line but it didn't fix the problem. And I haven't definre $templatevalues as an array anywhere.

Quote:

Originally Posted by Lynne (Post 2222930)
Also, is it *any* template you render via a plugin on that site that causes issues, or just this one? If it is any template, then I would suspect something like mod_security or suhosin to be the problem. Have you run diagnostics > problematic webserver modules?

Nope... just this plugin. And our host said that mod_security was blocking it but they whitelist it for us.

Problematic Webserver pops up with No to "Module Loaded" and "AJAX Unicode Issue".

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

Just a minor update. When I add your code:
Code:

vB_Template::preRegister('header', array('templatevalues' => $templatevalues));
This is the error I get:

Fatal error: Call to a member function render() on a non-object in /home/fpaul46/public_html/forum/includes/class_core.php(4257) : eval()'d code on line 2

thunderclap82 07-21-2011 09:03 PM

No other ideas?

kh99 07-21-2011 09:22 PM

Ah, yeah, I can't believe I didn't think of this before, but did you try a different hook location, like maybe parse_templates? The one you're using is actually in the vB_Template code and is called when a variable is registered, so that could be causing strange things to happen.


All times are GMT. The time now is 02:29 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.01062 seconds
  • Memory Usage 1,760KB
  • 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
  • (7)bbcode_code_printable
  • (2)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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