Nullified Posted May 27, 2012 Share Posted May 27, 2012 It seems that my .js include has broken. It may have been like this before the upgrade to v5, however I didn't notice until after the upgrade. I have a .js file: {if $pagetitle eq $LANG.carttitle}<link rel="stylesheet" type="text/css" href="templates/orderforms/{$template}/style.css" /> <script type="text/javascript" src="templates/orderforms/{$carttpl}/js/main.js"></script>{/if} The if statement works and outputs the code correctly: <link rel="stylesheet" type="text/css" href="templates/orderforms/custom/style.css" /> <script type="text/javascript" src="templates/orderforms/custom/js/main.js"></script> The stylesheet works fine, however the js does not. I have verified the file is accessible via the browser (firefox view code link). Sadly, the functions do not work unless I place them directly inside my {literal} javascript tag within the head of the page. What may cause the .js file to not work, even if the code works when placed directly in the page? My header.tpl: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> {if $systemurl}<base href="{$systemurl}" /> {/if} <title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title> <link rel="copyright" href="http://www.*********.com/copyright.php" /> <link rel="shortcut icon" href="http://www.*********.com/images/icons/favorite.ico" /> <link rel="stylesheet" type="text/css" href="templates/{$template}/style.css" /> {if $pagetitle eq $LANG.carttitle}<link rel="stylesheet" type="text/css" href="templates/orderforms/{$template}/style.css" /> <script type="text/javascript" src="templates/orderforms/{$carttpl}/js/main.js"></script> {/if} <script type="text/javascript" src="includes/jscript/jquery.js"></script> <script type="text/javascript" src="includes/jscript/custom.js"></script> {if $pagetitle eq $LANG.carttitle}{literal}<script type="text/javascript"> function toggleValue(obj, criteria) { if (document.getElementById(criteria).checked = true) { document.getElementById(obj).value = "{/literal}{$LANG.domainavailable}{literal}"; } else { document.getElementById(obj).value = "{/literal}{$LANG.domainremove}{literal}"; } } function removeItem(type,num,txt) { txt = txt || "{/literal}{$LANG.cartremoveitemnotify}{literal}"; if (type == 'n') {alert("{/literal}{$LANG.cartremoveitemdeny}{literal}"); return;} if (confirm(txt)) window.location = 'cart.php?a=remove&r='+type+'&i='+num; } function emptyCart(type,num,txt) { txt = txt || "{/literal}{$LANG.cartemptynotify}{literal}"; if (confirm(txt)) window.location = 'cart.php?a=empty'; } function showNotes(txt,btnValue) { txt = txt || "{/literal}{$LANG.cartenternotes}{literal}"; if (confirm(txt)) { jQuery("#notesField").slideDown(); return false; } else { jQuery("#submitFRMBTN").attr('value') = btnValue; return true; } } </script> {/literal}{/if} {if $livehelpjs}{$livehelpjs}{/if} <meta data excluded for readability /> {if $headoutput}{$headoutput}{/if} </head> <body> <center> My header.tpl output: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <base href="https://my.*********.com/" /> <title>Shopping Cart - *********</title> <link rel="copyright" href="http://www.*********.com/copyright.php" /> <link rel="shortcut icon" href="http://www.*********.com/images/icons/favorite.ico" /> <link rel="stylesheet" type="text/css" href="templates/custom/style.css" /> <link rel="stylesheet" type="text/css" href="templates/orderforms/custom/style.css" /> <script type="text/javascript" src="templates/orderforms/custom/js/main.js"></script> <script type="text/javascript" src="includes/jscript/jquery.js"></script> <script type="text/javascript" src="includes/jscript/custom.js"></script> <script type="text/javascript"> function toggleValue(obj, criteria) { if (document.getElementById(criteria).checked = true) { document.getElementById(obj).value = "Available! Order Now"; } else { document.getElementById(obj).value = "Remove Selected"; } } function removeItem(type,num,txt) { txt = txt || "Are you sure you want to remove this item from your cart?"; if (type == 'n') {alert("You are not permitted to remove this item from your cart."); return;} if (confirm(txt)) window.location = 'cart.php?a=remove&r='+type+'&i='+num; } function emptyCart(type,num,txt) { txt = txt || "Are you sure you want to empty your shopping cart?"; if (confirm(txt)) window.location = 'cart.php?a=empty'; } function showNotes(txt,btnValue) { txt = txt || "Would you like to enter any notes / additional information for the staff?"; if (confirm(txt)) { jQuery("#notesField").slideDown(); return false; } else { jQuery("#submitFRMBTN").attr('value') = btnValue; return true; } } </script> <meta data excluded for readability /> </head> <body> <center> 0 Quote Link to comment Share on other sites More sharing options...
Nullified Posted May 27, 2012 Author Share Posted May 27, 2012 I forgot to post the js: function showCCForm() {jQuery("#ccinputform").slideDown();} function hideCCForm() {jQuery("#ccinputform").slideUp();} function useExistingCC() {jQuery(".newccinfo").hide();} function enterNewCC() {jQuery(".newccinfo").show();} function hideID(obj) {document.getElementById(obj).style.display = 'none';} function showID(obj) {document.getElementById(obj).style.display = 'block';} function showControls(id2Show) { if (document.getElementById('domainincart')) hideID('domainincart'); if (document.getElementById('domainregister')) hideID('domainregister'); if (document.getElementById('domaintransfer')) hideID('domaintransfer'); if (document.getElementById('domainowndomain')) hideID('domainowndomain'); if (document.getElementById('domainsubdomain')) hideID('domainsubdomain'); if (document.getElementById('domain' + id2Show)) showID('domain' + id2Show); } function toggleBG(obj, class) { obj.parentNode.childNodes[1].className = (obj.parentNode.childNodes[1].className == class ? '' : class); } function toggleTOS(obj) { jQuery('input[id=accepttos]').attr('checked', (jQuery('img[id='+obj+']').attr('src') == 'images/custom/x.gif' ? 'checked' : '')); jQuery('img[id='+obj+']').attr ('src', (jQuery('img[id='+obj+']').attr ('src') == 'images/custom/x.gif' ? 'images/custom/check.gif' : 'images/custom/x.gif') ); } function setDomainContactInfo() { jQuery("input[name=domaincontactfirstname]").val(jQuery("input[name=firstname]").val()); jQuery("input[name=domaincontactlastname]").val(jQuery("input[name=lastname]").val()); jQuery("input[name=domaincontactaddress1]").val(jQuery("input[name=address1]").val()); jQuery("input[name=domaincontactaddress2]").val(jQuery("input[name=address2]").val()); jQuery("input[name=domaincontactcity]").val(jQuery("input[name=city]").val()); //Do not change order of country and state jQueries jQuery("select[name=domaincontactcountry]").val(jQuery("select[name=country]").val()); domainstatechange(); jQuery("input[name=domaincontactstate]").val(jQuery("input[name=state]").val()); jQuery("select[name=domaincontactstate]").val(jQuery("select[name=state]").val()); jQuery("input[name=domaincontactpostcode]").val(jQuery("input[name=postcode]").val()); jQuery("input[name=domaincontactemail]").val(jQuery("input[name=email]").val()); jQuery("input[name=domaincontactphonenumber]").val(jQuery("input[name=phonenumber]").val()); jQuery("input[name=domaincontactcompanyname]").val(jQuery("input[name=companyname]").val()); } function showLoginPopup() { event.preventDefault(); $.prompt('Example 12<p>Save these settings?</p>',{ opacity: 1, buttons: {Apply:1, Maybe:2, Never:3}, prefix: 'colsJqi' }).children('#colsJqi').corner(); } 0 Quote Link to comment Share on other sites More sharing options...
disgruntled Posted May 27, 2012 Share Posted May 27, 2012 (edited) Firstly i note that you are direct linking, you do not need to do this, a relative link will suffice unless you are trying to include things from a remote source. If this is the case, check your server settings, maybe remote includes have been disabled. by hardcoding your links to files in you break an ssl certificate, unless you always use ssl to collect them, which your example does not. which i guess means this isnt being used in part of the ordering? but looks like it is. Secondly, An upgrade from 4 - 5 should not break anything if you are just upgrading a vanilla installation, however when you modify files you may find the old files incompatible with the new features, one instance is the old language files changed to a .php file type. For me this meant i had to make all my language file edits all over again. but at least i still had my old ones to go off Edited May 27, 2012 by disgruntled 0 Quote Link to comment Share on other sites More sharing options...
Nullified Posted June 9, 2012 Author Share Posted June 9, 2012 Are you referring to the copyright and shortcut icon? Those are not under my WHMCS directy which is why they are not relative paths. But they shouldn't have anything to do with my broken javascript. my .js includes are relative paths. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.