View Full Version : Javascript/Jquery not being run. [Answered]
exactly33
12-21-2009, 03:24 AM
Although, meddling with HTML/PHP and Javascript for the past few years, I have never understood why they wouldn't execute on certain pages. Ones that seemed to be pre-rendered through php or some other process would never run the animated jquery actions. I have attempted to place a few fancy Jquery applications inside my page and was rather disappointed when none of them would render. Of course, the website isn't fully completed but I would like some help. :D
http://adopt.universe-9.com/
Problems:
The banner should scroll as if on a cylinder (the blue clouds).
The menu should have an image sliding back and forth behind the text.
Thanks in advance.
Justin
exactly33
12-21-2009, 12:35 PM
I've uploaded the original template file, where the javascript is working.
http://adopt.universe-9.com/templates/default/original.html
Thanks again. :D
Seapyramid
12-21-2009, 02:12 PM
I've uploaded the original template file, where the javascript is working.
http://adopt.universe-9.com/templates/default/original.html
Thanks again. :D
JS is normally iniciated in the <head></head> PHP pages don't have that area for the JS to be started. It is possible to use JS in php but is done in a bit different process to enable it.
exactly33
12-22-2009, 06:39 PM
Right, dynamically loading it? How would I go about doing this? Would echoing work, so as to have it load on the front end?
Help? :P
Seapyramid
12-22-2009, 09:01 PM
My pages have been greatly changed from the original script.. but this is an idea of how I have JS incorporated & where it is placed
// Permissions
//**************************************************
// <editor-fold defaultstate="collapsed" desc="Permissions">
if ($isloggedin != 'yes') {
$article_title = $accden . "<br /><br />";
$article_content = $reqlogin;
// ************************************************** ********************
// Begin Template Definition
// ************************************************** ********************
//Define our current theme
$file = $themeurl;
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = str_replace(':ARTICLETITLE:',$article_title,$templ ate);
$template = str_replace(':ARTICLECONTENT:',$article_content,$t emplate);
$template = str_replace(':BROWSERTITLE:',$browsertitle,$templa te);
$template = str_replace(':SITENAME:',$sitename,$template);
echo $template;
return;
// ************************************************** ********************
// End Template Definition
// ************************************************** ********************
}
// </editor-fold>
//**************************************************
// POST Info
//**************************************************
// <editor-fold defaultstate="collapsed" desc="POST Info">
$act = $_POST["act"];
$rmto = $_POST["rmto"];
$rmfrom = $_POST["rmfrom"];
$ids = $_POST["ids"];
$order = $_POST["order"];
// </editor-fold>
// ************************************************** ********************
// End Prepwork - Output the page to the user
// This file lets a user mass move their adoptables...
// ************************************************** ********************
$article_content = '<script type="text/javascript">
<!--
function SetAllCheckBoxes(FormName, CheckValue) {
var myform = document.forms[FormName];
for (var i = 0; i < myform.length; i++) {
if (myform.elements[i].type == "checkbox") {
if (CheckValue) {
myform.elements[i].checked = CheckValue;
} else {
myform.elements[i].checked = "";
}
}
}
}
// -->
</script>';
switch ($act) {
exactly33
12-23-2009, 11:39 AM
Thanks so much for your help. :P
Of course, a noob solves his own questions. I realized that the actual template would be rendered in the root rather than in the template directory, thus effectively disallowing the template to actually load the external javascript. It couldn't find the resources. ^.^
Thanks anyways.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.