PDA

View Full Version : Editing server scripts in a template


Callmesnake13
02-20-2007, 07:35 PM
Okay I asked before, but nobody responded. I understand considering the number of people on here asking questions that are easily resolved simply by reading the documentation that is already available online - especially regarding templates. That said, I have been researching this for weeks now and am still not coming up with anything.

Here is the code in question:


<html><!-- InstanceBegin template="Templates/basic-main.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>My Site</title>
<!-- InstanceEndEditable --><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="aap2.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

<script>

var ads=new Array()
ads[0]='<a href="http://site.com" target="_blank"><img src="../images/ads/aroma.jpg" width="100" height="100" border="0"></a>'
ads[1]='<a href="http://www.site2.com" target="_blank"><img src="../images/ads/contrasts.jpg" width="100" height="100" border="0"></a>'

function randomorder(targetarray, spacing){

var randomorder=new Array()
var the_one
var z=0
for (i=0;i<targetarray.length;i++)
randomorder[i]=i

while (z<targetarray.length){
the_one=Math.floor(Math.random()*targetarray.lengt h)
if (targetarray[the_one]!="_selected!"){
document.write(targetarray[the_one]+spacing)
targetarray[the_one]="_selected!"
z++
}
}
}

</script>

<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.style2 {font-size: 11px}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; color: #333333;}
.style4 {font-weight: bold}
.style5 {
color: #000000;
font-weight: bold;
}
.style6 {color: #000000}
-->
</style>

<!-- InstanceEndEditable -->
</head>

All I am trying to do is ad or remove those images that appear in the random array (there are actually usually about 25 or so, I've removed most for the example to save space) but when I do this by hand in the template and update the dependent files they all get that error that templates cause when they've been linked to incorrectly. I don't see how or why this is possible, all things considered. They aren't linking to local files, and my links are formatted identically to the ones that were already there.

Is there a parameter in the code that needs to be adjusted as the different ads are added or replaced? I certainly don't see one, if this is the case.

The only other thing I can think of is that there is a script editing function for templates in Dreamweaver that I can't find.

I'm sorry for bothering you guys again about this, but I don't meet anyone that does this sort of thing in my various lines of work, and I GREATLY appreciate any information you can give me - even if it is just a link to the right article to read or something like that.

kona72
02-23-2007, 04:22 AM
Hi Snake...

I would advise getting away from using the DW templates when using dynamic pages. I can't say for sure but when i first started creating sites (Static) i used the DW template like it was going out of style. When i started adding dynamic aspects to pages, something ALWAYS messed up. I just stay away from them all together and use includes now...