Copy link to clipboard
Copied
I created a template for a web page. It looks perfect and the links work. Part of the page is a <div> that contains a map that is pan and zoomable. I use Zoomify to create the pan and zoom.
Below are two scripts, as they appear in the template, that are necessary for Zoomify to work. In the first there is one path to a js. In the second there are two paths to folders that are necessary. These paths work in the template..
I create the final web page from the template using File > New > ....
If I save the resulting file to the template folder, the map is displayed and pans and zooms. Let me point out that saving to this folder means that the paths to the Zoomify files do not need adjustment.
If I save it to any other folder, the map does not display and I get a "404 - Not Found" error message. I look at the file created and the path to the js has been modified correctly, but the path to the other two folders has not been modified. This lack of updating the paths is my problem.
The scripts are in a non-editable region. A short term fix is to create an editable region at their location and manually correct the paths. But that is a very poor solution.
If there is no reason for this to be happening intentionally, then there appears to be a bug. I would like to get your opinion.
<script type="text/javascript" src="../assets/zoom/ZoomifyImageViewerPro-min.js"></script>
<script type="text/javascript"> Z.showImage("myContainer", "../assets/maps/0312/map_0312_final","zSkinPath=../assets/zoom/Assets/Skins/Default&zNavigatorVisible=0&zToolbarVisible=1&zLogoVisible=0&zCoordinatesVisible=0&zInitialZoom=fit&zMinZoom=8&zMaxZoom=100"); </script>
Right. Use an absolute path to assets (https://yoursite.com/assets/etc....) instead of a document relative path.
Copy link to clipboard
Copied
I realized that putting the script in an editable region was not the optimum solution. The problem is that if a change is made to the template, then the web page created will be changed. This means that I have to go through all the associated files, and that will be more than 200 in the end, make the correction to the paths.
So my end solution is to intentionally enter a path in the template that will not work if the template is viewed in a browser, but the path will be correct when the web page is in its final location.
Copy link to clipboard
Copied
I am not sure how you are creating and using the template. If the template is created as an include file, then you will need to construct the links as if they resided in the main document.
Copy link to clipboard
Copied
Thank you for answering. Sorry, but I do not know what an "include file" is. I look it up on the internet and still not sure.
I create an html file as a template ... a plain old html file with head and body. Only the parts that are specific to each child are editable. The lines I wrote about are part of the code because they are needed for Zoomify to work.
But what do believe I understand is that I need to construct the links as they need to be when saved in their final location. That's what I have done at this point. It works, but means that I can't test the template without creating a child. But that is no big problem.
Copy link to clipboard
Copied
Sorry if I'm covering old ground here but I can't see your code so I must ask a lot of silly questions.
1. Are you working in a defined local site folder that resides on your primary hard drive?
2. Does your DWTemplate (.dwt) reside in the Templates folder within the site's root?
3. Did you validate code in your Template.dwt file to ensure it is error-free?
4. When creating your child page, did you use File > New > Site Template > Create and then immediately save your child page to the local site folder?
5. Can we see the path to scripts from your Template.dwt and the child page spawned from that template? DW should automatically resolve paths for you when the child page is saved.
6. The Templates folder is for template.dwt files ONLY. No other files or assets should ever be saved there.
7. Are you using links relative to Site Root or Document? Site root relative links work just fine on the server but may fail locally. For this reason, I prefer document relative links.
Copy link to clipboard
Copied
1. I'm using a virtual server on my drive. The virtual server allows me to see Zoomify images.
2. Yes
3. Yes. No errors or warnings.
4. Yes
5. Yes I can see the paths to the scripts. The first one
<script type="text/javascript" src="../assets/zoom/ZoomifyImageViewerPro-min.js"></script>
is changed (resolved) correctly when the webpage is created. The second two
<script type="text/javascript"> Z.showImage("myContainer", "../../assets/maps/0312/map_0312_final","zSkinPath=../../assets/zoom/Assets/Skins/Default&zNavigatorVisible=0&zToolbarVisible=1&zLogoVisible=0&zCoordinatesVisible=0&zInitialZoom=fit&zMinZoom=8&zMaxZoom=100"); </script>
are not changed (resolved) correctly. They are not changed at all in the page that is created.
6. Yes, I know that only templates go in the templates folder. I did an experiment and saved the created page to the templates folder only to see what was happening w.r.t. changing the links. When saved to the template folder no changes had to be made and so the resultant page worked correctly. I have removed that page from the folder.
7. The links I create in the template are relative to the template.
My solution is to create the paths in the template relative to the final destination of the web page for the paths that are not being resolved. This works, but means I can't simply test the template during construction. This is of course only an issue with pages that use Zoomify.
Marcus
I'm a novice, but it is my guess that the problem lies in the way the unresolved paths are embedded in the script.
Copy link to clipboard
Copied
I'm a novice, but it is my guess that the problem lies in the way the unresolved paths are embedded in the script.
That remark does not point to coming from a novice. You are dead right.
Keep in mind that Dreamweaver's template system is vastly outdated. The system was created by Macromedia back in the days when HTML documents were devoid of CSS and JS.
Copy link to clipboard
Copied
Ben,
I learned html and Dreamweaver when it was Macromedia. I'm now trying to update the website I had created:
to be simple so that it can work on small devices. It's a huge learning curve because so much is different.
Thanks for your input.
Marcus
Copy link to clipboard
Copied
DW Templates cannot re-write JavaScripts for you. They have never been able to do that and they never will.
You will need to create an editable region for those scripts so you can tweak the code in each child page that uses Zoomify.
I hope it's worth it.
Copy link to clipboard
Copied
I'm not asking it to rewrite a js. It is the path that is the problem.
Dreamweaver actually resolves the path to a js for me. It's the embedded paths to folders within the <script> </script> that is the problem. I accept that Dreamweaver can't resolve these paths. I've already described my work around.
Thank you for your help.
Marcus
Copy link to clipboard
Copied
Feel free to submit a feature request from your DW Help Menu. However, I suspect it's not logistically possible for DW to update scripts.
Copy link to clipboard
Copied
'This works, but means I can't simply test the template during construction. This is of course only an issue with pages that use Zoomify.'
Why don't you upload the scripts and zoomify assets to your remote server and link directly to the scripts/assets using the full url path in your template. That way the scripts will be available for you at construction level, assuming you are connected to the internet.
Copy link to clipboard
Copied
Right. Use an absolute path to assets (https://yoursite.com/assets/etc....) instead of a document relative path.
Copy link to clipboard
Copied
I agree with @Nancy OShea - if you can't use a server-side include that checks the path for you, the absolute path is your next best option.
Copy link to clipboard
Copied
I agree with @Nancy OShea - if you can't use a server-side include that checks the path for you, the absolute path is your next best option.
Absolute paths.....why didn't I think of that.............oh wait a minute did I mention that in an earlier post.