PDA

View Full Version : Template Impossibility ?


hennesse
07-19-2014, 11:39 PM
My site is hierarchical with many levels, and I want to include an up-arrow that will allow the use to navigate to the next-higher directory.

<a href=”../index.html”><img src=”up-arrow.gif”></a>All my pages (except home page) use the same template, so it would be nice if I could just include this in the template.

However, DW thinks I want to reference that particular instance of index.html, so it updates it to "../../../../index.html" Wrong!

Is there any hack I can use to make DW leave the reference alone?

Dave

edbr
07-21-2014, 01:24 AM
try edit in a text editor lik notepad. i realy thik this is a flaw in dw template system but i never use it so i maybe shouldnt say that

hennesse
07-21-2014, 01:44 AM
try edit in a text editor lik notepad. i realy thik this is a flaw in dw template system but i never use it so i maybe shouldnt say that

Thanks. I thought of another way:
<img src="up-arrow.gif" onClick='document.location="../index.html"' />DW updates the path to up-arrow.gif, but does NOT mess with the inline Javascript

A little clumsier, but it seems to work.
Dave

edbr
07-21-2014, 01:48 AM
good. cant resist saying you should maybe look at using includes rather than dw templates, just so much easier to update or change without site wide changing. I really just dont like them :)

Ricky55
07-21-2014, 03:46 PM
Its more a limitation of templates than a bug.

Dreamweaver basically just corrects paths to make them relative from the template.

I wouldn't use this method if you can help it. Relying on javascript to just get a link working isn't the best idea.

If you can I would really try to use includes as Ed suggests.

If you don't want to use PHP for a static site thats understandable. In this case you could look at using an app like Codekit of Hammer. These provide include like functionality without PHP.

Personally I always use PHP as it always comes in handy for other things even on a static site.

HTH

edbr
07-22-2014, 01:11 AM
dont forget the include using object as a option also
<object name="foo" type="text/html" data="foo.txt"/>

or simple javascript
<script type="text/javascript" src="include_html.js"></script>