The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
||||
|
||||
Need advice on adding a simple echo function to vBulletin
So I've been working on a skin that involves alot of rollover images, and I need to preload these images in the body tag. FYI, I'm using the Mickey Mouse macromedia rollover scripts becasue that is what was used on the site that im adapting the skin to...
I know I could manually insert the onLoad Javascript function into the body tag of every page that I have the rollovers on, but this is obviously cumbersome, and if i need to add new images to the preload array, I would probably have to go back and do it by hand. So with my limited php knowledge, I came up with this script: Code:
echo" onLoad=\"MM_preloadImages(\'images/cmb_final/header_nav/MB-header-over_02.gif\',\'images/cmb_final/header_nav/MB-header-over_03.gif\',\'images/cmb_final/header_nav/MB-header-over_04.gif\',\'images/cmb_final/header_nav/MB-header-over_05.gif\',\'images/cmb_final/header_nav/MB-header-over_06.gif\',\'images/cmb_final/header_nav/MB-header-over_07.gif\',\'images/cmb_final/header_nav/MB-header-over_09.gif\',\'images/cmb_final/header_nav/MB-header-over_10.gif\',\'images/cmb_final/header_nav/MB-header-over_11.gif\',\'images/cmb_final/header_nav/01-CTIover.gif\',\'images/cmb_final/header_nav/02-CSSover.gif\',\'images/cmb_final/header_nav/03-CNGover.gif\',\'images/cmb_final/header_nav/04-CSAover.gif\',\'images/cmb_final/header_nav/04-CSAover.gif\',\'images/cmb_final/header_nav/05-HDover.gif\',\'images/cmb_final/left_side_nav/btn_weddings_over.gif\',\'images/cmb_final/left_side_nav/btn_Honeymoons_over.gif\',\'images/cmb_final/left_side_nav/n_btn_getQuote_over.gif\',\'images/cmb_final/left_side_nav/btn_aboutUs_over.gif\',\'images/cmb_final/left_side_nav/btn_photoGallery_over.gif\',\'images/cmb_final/left_side_nav/btn_couplesLounge_over.gif\',\'images/cmb_final/left_side_nav/btn_messageBoard_over.gif\',\'images/cmb_final/left_side_nav/btn_loyaltyProgram_over.gif\',\'images/cmb_final/left_side_nav/btn_preferredAgents_over.gif\',\'images/cmb_final/left_side_nav/btn_brochures_over.gif\',\'images/cmb_final/left_side_nav/btn_contactUs_over.gif\',\'images/cmb_final/left_side_nav/btn_faq_over.gif\',\'images/cmb_final/left_side_nav/btn_home_over.gif\',\'images/cmb_final/left_side_nav/btn_GroupBenefits.gif\',\'images/cmb_final/left_side_nav/btn_GroupBenefits_over.gif\')\"" Now if I assign a variable name to that and add that to this plugin which I'm already running, will that allow me to call the echo function on the page with just the variable name in the same fashion that I call in the templates?: Code:
eval('$nbHeader = "' . fetch_template('nbHeader') . '";'); eval('$nbLeftSidebar = "' . fetch_template('nbLeftSidebar') . '";'); eval('$nbRightSidebar = "' . fetch_template('nbRightSidebar') . '";'); eval('$nbFooter = "' . fetch_template('nbFooter') . '";'); Code:
eval('$nbImgPreload = "echo' blah blah blah '";'); If not, can you point me in the right direction? Also, if it will work, is there a more efficient way? Thanks. -----------------------------------------------------EDIT----------------------------------------------------- after some embarrassingly long, hard thought I came up with the idea of creating a template with the image preloader code, and called that into the body tag. Now this works for the page I'm testing the template on ( forumdisplay ), but there are some foreseeable problems.First off, when I have the setting "Add Template Name in HTML comments" turned on in the Forums General settings, this code does not render as html, because the comments end up in the <body> tag which causes all of the code in the template to be printed at the top of the page. This isn't a huge deal, as I can turn the setting off, but when I'm building a skin I like to see the name of which templates aren't cooperating. I'm toying with the idea of including the whole body tag in the template, but I've had trouble doing a site-wide search and replace of the body tag before in vBulletin... Second and more importantly, I know a few pages already make use of the onLoad event in the body tag for purposes other than image preloads, how should I handle this? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|