vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Where to implement a JavaScript pop-up code (https://vborg.vbsupport.ru/showthread.php?t=272290)

cayne 10-18-2011 03:38 PM

Where to implement a JavaScript pop-up code
 
Hi everybody,
I got the following code, which I need to have on "forumhome" as well as "showthread", I simply added the code to the according templates on vBulletin 3.8.x - but now I've upgraded to v4 and when I just add the code it seems to generate longer loading times/general errors. So I'd like to ask, where's the right place to add such code. Thanks in advance.

Here's the code in question:

Code:

<script type="text/javascript" id="adcreative_script">
(function(){
var adcr = document.createElement('script');
adcr.type = 'text/javascript';
adcr.async = true;
adcr.src = '//static.adclickx.com/adcreative.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(adcr);
})();
</script>


Lynne 10-18-2011 03:41 PM

You would just add them to the FORUMHOME and SHOWTHREAD templates. Or, you could put it in the headinclude and put a condition around it to only show it on those two pages.

cayne 10-18-2011 03:51 PM

Ah ok, so I simply copy the code to the bottom of the template and that's it? That's what I did before, but like I said, I had the feeling the code was causing weird loading errors this time around. But I have to say I was using a different code back on the v3 version of vBulletin, so maybe it's not the position within the v4 version, but the code itself, or rather the file on the ad-server.

But as long as it's ok to just copy the code into the template I'm relieved.
And thanks for the super-quick response. Much appreciated! :)

Just one more thing, as you said, if I put it into the head-include, it will be loading on all pages? Because that's actually better than just on forum-home and showthread...

Lynne 10-18-2011 04:49 PM

If you put it in the headinclude template, then that will be on all pages.


All times are GMT. The time now is 05:48 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.01027 seconds
  • Memory Usage 1,711KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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