vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Adding javascript to head of custom vbulletin powered page (https://vborg.vbsupport.ru/showthread.php?t=194261)

Chunky Monkey 10-22-2008 11:06 AM

Adding javascript to head of custom vbulletin powered page
 
Hi,

I created a custom vbulletin page that needs some javascript in the head tag in order for it to work properly.

Can somebody please tell me how I can include the javascript in the <head> for this php script only?

Thank you!

Dismounted 10-22-2008 11:50 AM

In your custom template, you can place code inside the head tags.

Chunky Monkey 10-22-2008 05:42 PM

Can you please tell me which template I want to edit? I checked out header and header includes but neither looked right. Thanks!

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

Is it GENERIC_SHELL that I want? or maybe header include after all?

Lynne 10-22-2008 05:48 PM

You said you created a custom page. So, what is the name of the template you created to use with that custom page?

Chunky Monkey 10-22-2008 06:20 PM

Thanks for responding, Lynne. I got it to work by adding the javascript that needed to go in the <head></head> tags to the headerinclude template.

However, it's now being put in every page when it is only needed in one. Do you know the conditional I can use to make the javascript only appear when i'm at that certain page? I think it's something like

Code:

<if condition="is_script(MYSCRIPTNAME)">
blah...
</if>

Thank you

Lynne 10-22-2008 07:34 PM

HTML Code:

<if condition="THIS_SCRIPT == 'yourpage'>
blah...
</if>

You need to have defined THIS_SCRIPT at the top of your php script.

Chunky Monkey 10-22-2008 07:51 PM

Thanks, Lynne. I defined THIS_SCRIPT as instructed by the "how to add vbulletin powered pages article".

It worked perfectly, thank you again!

Dismounted 10-23-2008 09:34 AM

Even though it will only display your JS code on your page, the condition is executed on every page (nothing on its own, but every little bit counts). The best solution would be creating your own template, and putting the code inside that template, instead of the current solution.


All times are GMT. The time now is 02:36 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.01193 seconds
  • Memory Usage 1,720KB
  • 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)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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