vb.org Archive

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

Scanu 09-13-2011 09:07 PM

Vbcms global_start
 
Hi i need to load a plugin everywhere in the forum and in the CMS
Right now i used global_start as hook but don't work in the cms
What's the right hook?
This is the code that would be work
PHP Code:

$template_hook['headinclude_javascript'] .= 'test'


kh99 09-14-2011 10:43 AM

I'm not 100% certain, but try global_bootstrap_init_start.

Scanu 09-14-2011 11:02 AM

I've already tried all global hook

kh99 09-14-2011 11:18 AM

It turns out global_bootstrap_init_start was too early, but it seems to work for me using global_bootstrap_init_complete.

Scanu 09-14-2011 11:20 AM

I will re-try but are sure that you try this?
PHP Code:

$template_hook 


kh99 09-14-2011 11:33 AM

Yes, I tried your code:

PHP Code:

$template_hook['headinclude_javascript'] .= 'test'


and then in the html I got this:
Code:

        var RELPATH = "";
        var PATHS = {forum : ""}
// -->
</script>
<script type="text/javascript" src="http://10.0.0.4/forum4/clientscript/vbulletin-core.js?v=415"></script>
test


        <link rel="alternate" type="application/rss+xml" title="Forums 4.1.5 RSS Feed" href="http://10.0.0.4/forum4/external.php?type=RSS2" />


But it did seem like the first time I did it it didn't work, so maybe there's some caching going on or something.

Scanu 09-14-2011 11:38 AM

You're rigth man this code work very well
PHP Code:

$template_hook['headinclude_javascript'] .= 'test'

but if put my code (longer) with some conditionals added doesn't work maybe is the conditionals?

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

Yes confirm that the conditionals doesn't work
here there is my code
PHP Code:

if ($vbulletin->options['guest_warn_active'])
{
if (
$show['guest'])
{
if (
$vbulletin->options['guest_warn_cloasable_active']){if ($vbulletin->options['guest_warn_cookie_off']){ 
$template_hook['headinclude_javascript'] .= 'test3';
}
else {
$template_hook['headinclude_javascript'] .= 'test2';
}
}
else
{
$template_hook['headinclude_javascript'] .= 'test4';
}}


All that is in the conditionals doesn't work in global_bootstrap_init_complete instad of global_start (the same code work perfectly), all is out of the conditionals work both. I will delete some code until i found the bad condition

kh99 09-14-2011 12:31 PM

Probably that's it. That hook if called from a function, so you need a global statement for any globals that you use (except the common ones like $vbulletin, $template_hook, $show, etc).

Edit: Sorry, I hadn't read your second post before I wrote that - it doesn't look like it needs any more global statements.

Scanu 09-14-2011 12:32 PM

FOUND! if ($show['guest']) doesn't work in cms i will try "is membe of"

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

"is member of 1" is the only solution i hope that this can help other people with this problem
THANKS FOR THE HELP :)


All times are GMT. The time now is 09:40 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.01032 seconds
  • Memory Usage 1,733KB
  • 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
  • (1)bbcode_code_printable
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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