This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > August 2005 > Template problem again





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Template problem again
tb5821

2005-08-29, 11:22 pm

I have a dreamweaver template that I created sliced up and placed in a folder
called templates. I also have 2 other folders html. and images. Now the code
works for the pages in the html file but I tried to create my index.html file
and the rollovers etc do not work and since its a template it will not let me
edit where the rollover files are.




.dwt code:

<html>
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>layout1_templatex</title>
<!-- TemplateEndEditable --><meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<!-- ImageReady Preload Script (layout1_templatex.psd) -->
<script type="text/javascript">
<!--

function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
header_slice_services_btn_over =
newImage("images/header_slice-services_btn_o.jpg");
header_slice_products_btn_over =
newImage("images/header_slice-products_btn_o.jpg");
header_slice_directions_btn_over =
newImage("images/header_slice-directions_btn.jpg");
preloadFlag = true;
}
}

// -->
</script>
<!-- End Preload Script -->
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head>
<body bgcolor="#FFFFFF" onload="preloadImages();">
<!-- ImageReady Slices (layout1_templatex.psd) -->
<table id="Table_01" width="800" height="600" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td>
<!-- TemplateBeginRepeat name="header" --><img name="header_slice"
src="../images/header_slice.jpg" width="800" height="198" border="0" alt=""
usemap="#header_slice_Map" /><!-- TemplateEndRepeat --></td>
</tr>
<tr>
<td>
<!-- TemplateBeginEditable name="body" --><img
src="../images/body_slice.jpg" width="800" height="375" alt="" /><!--
TemplateEndEditable --></td>
</tr>
<tr>
<td>
<!-- TemplateBeginRepeat name="footer" --><img
src="../images/footer_slice.jpg" width="800" height="27" border="0" alt=""
usemap="#footer_slice_Map" /><!-- TemplateEndRepeat --></td>
</tr>
</table>
<map name="header_slice_Map">
<area shape="rect" alt="" coords="669,129,723,141" href="#"
onmouseover="changeImages('header_slice',
'../images/header_slice-directions_btn.jpg'); return true;"
onmouseout="changeImages('header_slice', '../images/header_slice.jpg');
return true;"
onmousedown="changeImages('header_slice',
'../images/header_slice-directions_btn.jpg'); return true;"
onmouseup="changeImages('header_slice',
'../images/header_slice-directions_btn.jpg'); return true;" />
<area shape="rect" alt="" coords="576,128,622,138" href="#"
onmouseover="changeImages('header_slice',
'../images/header_slice-products_btn_o.jpg'); return true;"
onmouseout="changeImages('header_slice', '../images/header_slice.jpg');
return true;"
onmousedown="changeImages('header_slice',
'../images/header_slice-products_btn_o.jpg'); return true;"
onmouseup="changeImages('header_slice',
'../images/header_slice-products_btn_o.jpg'); return true;" />
<area shape="rect" alt="" coords="508,131,510,132" href="#"
onmouseover="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;"
onmouseout="changeImages('header_slice', '../images/header_slice.jpg');
return true;"
onmousedown="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;"
onmouseup="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;" />
<area shape="rect" alt="" coords="484,132,528,142" href="#"
onmouseover="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;"
onmouseout="changeImages('header_slice', '../images/header_slice.jpg');
return true;"
onmousedown="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;"
onmouseup="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;" />
</map>
<map name="footer_slice_Map">
<area shape="rect" alt="" coords="496,9,542,18" href="#" />
<area shape="rect" alt="" coords="428,9,467,18" href="#" />
<area shape="rect" alt="" coords="360,9,398,18" href="#" />
<area shape="rect" alt="" coords="303,9,331,18" href="#" />
</map>

<!-- End ImageReady Slices -->
</body>
</html>


Index.html code:

<html>
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>layout1_templatex</title>
<!-- TemplateEndEditable --><meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<!-- ImageReady Preload Script (layout1_templatex.psd) -->
<script type="text/javascript">
<!--

function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
header_slice_services_btn_over =
newImage("images/header_slice-services_btn_o.jpg");
header_slice_products_btn_over =
newImage("images/header_slice-products_btn_o.jpg");
header_slice_directions_btn_over =
newImage("images/header_slice-directions_btn.jpg");
preloadFlag = true;
}
}

// -->
</script>
<!-- End Preload Script -->
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head>
<body bgcolor="#FFFFFF" onload="preloadImages();">
<!-- ImageReady Slices (layout1_templatex.psd) -->
<table id="Table_01" width="800" height="600" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td>
<!-- TemplateBeginRepeat name="header" --><img name="header_slice"
src="../images/header_slice.jpg" width="800" height="198" border="0" alt=""
usemap="#header_slice_Map" /><!-- TemplateEndRepeat --></td>
</tr>
<tr>
<td>
<!-- TemplateBeginEditable name="body" --><img
src="../images/body_slice.jpg" width="800" height="375" alt="" /><!--
TemplateEndEditable --></td>
</tr>
<tr>
<td>
<!-- TemplateBeginRepeat name="footer" --><img
src="../images/footer_slice.jpg" width="800" height="27" border="0" alt=""
usemap="#footer_slice_Map" /><!-- TemplateEndRepeat --></td>
</tr>
</table>
<map name="header_slice_Map">
<area shape="rect" alt="" coords="669,129,723,141" href="#"
onmouseover="changeImages('header_slice',
'../images/header_slice-directions_btn.jpg'); return true;"
onmouseout="changeImages('header_slice', '../images/header_slice.jpg');
return true;"
onmousedown="changeImages('header_slice',
'../images/header_slice-directions_btn.jpg'); return true;"
onmouseup="changeImages('header_slice',
'../images/header_slice-directions_btn.jpg'); return true;" />
<area shape="rect" alt="" coords="576,128,622,138" href="#"
onmouseover="changeImages('header_slice',
'../images/header_slice-products_btn_o.jpg'); return true;"
onmouseout="changeImages('header_slice', '../images/header_slice.jpg');
return true;"
onmousedown="changeImages('header_slice',
'../images/header_slice-products_btn_o.jpg'); return true;"
onmouseup="changeImages('header_slice',
'../images/header_slice-products_btn_o.jpg'); return true;" />
<area shape="rect" alt="" coords="508,131,510,132" href="#"
onmouseover="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;"
onmouseout="changeImages('header_slice', '../images/header_slice.jpg');
return true;"
onmousedown="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;"
onmouseup="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;" />
<area shape="rect" alt="" coords="484,132,528,142" href="#"
onmouseover="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;"
onmouseout="changeImages('header_slice', '../images/header_slice.jpg');
return true;"
onmousedown="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;"
onmouseup="changeImages('header_slice',
'../images/header_slice-services_btn_o.jpg'); return true;" />
</map>
<map name="footer_slice_Map">
<area shape="rect" alt="" coords="496,9,542,18" href="#" />
<area shape="rect" alt="" coords="428,9,467,18" href="#" />
<area shape="rect" alt="" coords="360,9,398,18" href="#" />
<area shape="rect" alt="" coords="303,9,331,18" href="#" />
</map>

<!-- End ImageReady Slices -->
</body>
</html>

Alan

2005-08-29, 11:22 pm



> onmouseover="changeImages('header_slice',
> '../images/header_slice-services_btn_o.jpg'); return true;"
> onmouseout="changeImages('header_slice', '../images/header_slice.jpg');
> return true;"


that's not mm rollover scripting, so dw doesn't "manage" the paths for you.

one fix (if your site has it's own domain and this site is defined to the
root of it) is to edit the template .dwt file, and use site root relative
paths in the scripting. The site root relative paths will work anyplace in
the site (but may not work in F12 preview)

back the file up first-
then try these two find and replace in source:

to get the stuff within the map tag-
find:
'../images

replace with
'/images

to get the stuff in the function in the head section-
find:
("images
replace with
("/images

there may be some others to fix but that gets the majority of them without
messing with other stuff on the page afaik.

save the .dwt file and dw will update the child pages for you since the
changes are in locked parts of the pages.

tb5821

2005-08-29, 11:22 pm

Originally posted by: Newsgroup User

one fix (if your site has it's own domain and this site is defined to the
root of it) is to edit the template .dwt file, and use site root relative
paths in the scripting. The site root relative paths will work anyplace in
the site (but may not work in F12 preview)


I have not been able to try it yet, but can you explain the above a bit more?
I do have a domain name setup and hosting but have not transfered the files to
the server. Are you saying that if I changed the mentioned items and editied
the site on the server instead of localy it should work?

Alan

2005-08-29, 11:22 pm



> one fix (if your site has it's own domain and this site is defined to the
> root of it) is to edit the template .dwt file, and use site root relative
> paths in the scripting. The site root relative paths will work anyplace in
> the site (but may not work in F12 preview)
>
>
> I have not been able to try it yet, but can you explain the above a bit more?
> I do have a domain name setup and hosting but have not transfered the files to
> the server. Are you saying that if I changed the mentioned items and editied
> the site on the server instead of localy it should work?
>


No.
I'm saying that if your site has it's own domain, you can use Site Root
relative paths for this js stuff. Site root relative paths will work when
the pages are uploaded, but won't work during local F12 preview.

Because.... they are relative to the site root and the local preview is
using your HD file system for paths unless you set up a testing server...


Gary White

2005-08-30, 4:21 am

On Mon, 29 Aug 2005 22:24:05 -0400, Alan
<dont_mail_me_period@macromedia.com> wrote:

>Site root relative paths will work when
>the pages are uploaded, but won't work during local F12 preview.



They will work on a page previewed using a temp file.

Gary
Alan

2005-08-30, 4:21 am

I didn't know if dw would convert those for 3rd-party scripts when making
the temp file

>
>
> They will work on a page previewed using a temp file.
>
> Gary


Murray *TMM*

2005-08-30, 7:27 pm

If the link is embedded in the js call, it won't.

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================

"Alan" <dont_mail_me_period@macromedia.com> wrote in message
news:BF3948B5.245937%dont_mail_me_period@macromedia.com...
>I didn't know if dw would convert those for 3rd-party scripts when making
> the temp file
>
>



Gary White

2005-08-30, 7:27 pm

On Mon, 29 Aug 2005 23:20:21 -0400, Alan
<dont_mail_me_period@macromedia.com> wrote:

>I didn't know if dw would convert those for 3rd-party scripts when making
>the temp file



No, it won't. Momentary brain freeze for me.

Gary
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews