PDA


View Full Version : Javascript on vb page breaks


Renada
06-21-2005, 09:42 PM
Hi,

I've created a vb powered page which has a link in my nav bar. Works perfectly.

The problem I have is when adding


define('VBA_PORTAL', true);
define('VBA_PAGE', 'include');

to the top of the page and

eval('$HTML = "' . fetch_template('XXXXX') . '";');

print_portal_output($home, $HTML);

to the bottom the javascript in my page no longer works.

I had the same problem when trying to create a vBA page using the same code.

Thanks for any suggestions to fix this.
Renada

Brian
06-22-2005, 11:36 AM
Which file exactly are you adding this too?

Renada
06-23-2005, 12:07 AM
Brian,

I created a vbulletin driven page using Live Wire's code and called it maths.php which is in my navigation bar and works perfectly. (or it does until I add the portal to the left hand side).

It pulls the information from a template called maths2.

So in the file maths.php I put the above code at the top and bottom, changing XXXX to maths2.

I do hope I'm making sense here. LOL!

Thanks,
Renada

Brian
06-23-2005, 01:50 PM
Check your maths2 template and see if there's some javascript near the top, before the <body> tag. If so, you'll probably want to add it to your adv_portal template.

Renada
06-23-2005, 02:28 PM
Brian,

Thank you so much yet again, worked perfectly :)

Regards,
Renada

Renada
06-23-2005, 04:32 PM
Brian,

Thank you so much yet again, worked perfectly :)

Is this the rule? Any javascript in created pages needs to be added to this template if you want it to work with the portal on the left?

Regards,
Renada

Brian
06-23-2005, 05:19 PM
With people integrating other vB files, HTML files, and etc, many of these will include all of the header tags in the output. To comply with XHTML standards and to ensure that the pages display properly, we have to strip out everything in the output of those files before and including the <body> tag. So right now, adding the code to the adv_portal template is really the only way to do this. We should have a better method for this in a future version though now that more and more people are integrating other files.

Renada
06-23-2005, 06:38 PM
Thanks Brian :)

Buffer.OverRun
08-21-2007, 04:45 PM
So right now, adding the code to the adv_portal template is really the only way to do this. We should have a better method for this in a future version though now that more and more people are integrating other files.

sorry to post in such an old topic, but how can I include javascript in the BODY of every vB page?

it should be immediately after

<BODY>

& before

</BODY>

Brian
08-21-2007, 05:09 PM
Your best bet would probably be to add the code in the $header template.

Buffer.OverRun
08-22-2007, 07:31 AM
Your best bet would probably be to add the code in the $header template.

thank you.
I also received info from another source to add the .js include to the top of the header file or the bottom of the footer.

I tried the top of the header & it appears to be functioning well (so far...)

thanks for the reply. http://www.vbadvanced.com/forum/images/icons/icon14.gif