This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > August 2004 > "dynamic" menu with template parameters?





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 "dynamic" menu with template parameters?
zu

2004-08-12, 4:16 am

I'm not yet quiet understanding the concept of template parameters and optional
regions.
Can someone point me to a good ressource or give me a hint on how to solve a
propably trivial problem:

The navigation on each page is the same except that one <li> element on the
navigation list has a class="current" and an additional span within the <a>
with the text "You are here">.
For the current <li> there should be no link.

That's what I want to accomplish and therefor need a template parameter or
list of parameters to choose which navigation element should become the
"current".

How can I do this?
What's the theory? Some best practices or experiences?

zu

2004-08-13, 12:16 pm

Thank you Murray

This seems to be the perfect solution
... but for some esoteric reasons it just doesn't seem to work.
I can't see exactly where you use single quotes and where double quotes. This
was one of the possible reasons it didn't work. After changing in several ways
and soing some typos from time to time, I get quiet frustrated because again
and again I get a silly error.

It went from "unbalanced quotes or missing attribute" to "@@(...)@@
directives cannot be used inside editable regions" to something like
"unterminated string" etc.

All reasonable error messages but really I can't see the obvious typo(s).

Maybe some other eyes can see it.

The actual error with the following code is :"There is an error at line 73,
column 1 (absolute position 2050) of "D:\Websites\mcweb\Templates\default.dwt":
@@(...)@@ directives cannot be used inside editable regions", which doesn't
seem to make sense in my humble opinion.

Do you see, where I made a mistake?
I think I give up before my holidays.

Here the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Christian Zumbrunnen" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>mc web - unkomplizierte Internet & PC Dienstleistungen</title>
<!-- TemplateEndEditable -->
<style type="text/css" media="screen">
@import url(../css/default.css);
</style>
<!-- TemplateParam name="aktivesmenu" type="text" value="startseite" -->
<!-- TemplateBeginEditable name="head" -->

<!-- TemplateEndEditable -->
</head>
<body>
<div id="container">
<p class="skipLink"><a href="#startContent" accesskey="2">Zum Hauptbereich
wechseln</a></p>
<hr class="hidden" />
<div id="branding"> <img src="../images/mcweb-logo.gif" alt="mc web Logo"
width="336" height="118" hspace="5" vspace="5" />
<!-- <h1 id="title">mc web</h1> -->
</div>
<!-- end of #branding -->
<!-- <p id="tagLine">Web Design Techniques And Other Assorted Ramblings</p>
-->
<!-- TemplateBeginEditable name="breadcrumb" -->
<div id="breadcrumb"> Startseite / </div>
<!-- TemplateEndEditable -->
<div id="mainBody">
<div id="tools">
<div class="menu">
<h2>Inhalt</h2>
<li><a href="index.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Startseite
@@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<li><a href="leistungen.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Serviceleistungen
@@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<li><a href="preise.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Preise
@@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<li><a href="produkte.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Hard- &
Software @@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<li><a href="kontakt.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Kontakt
@@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<ul class="navigation">
</ul>
</div>
<div class="menu">
<h2>Angebote</h2>
<ul class="articleList">
<li><a href="http://#">Angebot 1</a></li>
<li><a href="http://#">Angebot 2</a></li>
</ul>
</div>
</div>
<!-- end of #tools -->
<div id="mainContent">
<!-- TemplateBeginEditable name="mainContent" -->
mainContent
<!-- TemplateEndEditable -->
<p class="clear"></p>
</div>
<!-- end of #mainContent -->
</div>
<!-- end of #mainBody -->
<div id="pageInfo">
<div id="license">
<p> <img src="../images/mcweb-46.gif" width="46" height="46" vspace="5"
/> Christian Zumbrunnen<br />
Eidg. dipl. Wirtschaftsinformatiker HF<br />
<strong>079 784 52 37</strong> (Mo – Sa: 8:00 – 20:00)<br
/>
<strong><a
href="mailto:mcweb@chruezundquer.ch">mcweb@chruezundquer.ch</a></strong> </p>
<p class="copy">© 2004 <a href="kontakt.htm" title="Kontakt
Informationen" accesskey="9">mc web</a></p>
</div>
<!-- end of #license -->
</div>
<!-- end of #pageInfo -->
</div>
<!-- end of #container -->
</body>
</html>

Murray *TMM*

2004-08-13, 12:16 pm

> The actual error with the following code is :"There is an error at line
73,
> column 1 (absolute position 2050) of

"D:\Websites\mcweb\Templates\default.dwt":
> @@(...)@@ directives cannot be used inside editable regions", which

doesn't
> seem to make sense in my humble opinion.


Ahh - but it does make sense. You cannot do such things in an editable
region.

To use such methods, you would have to use them in non-editable parts of the
page.

In addition,

@@(aktivesmenu=="startseite"?'class='current'':")@@>
----------------------------------------------------------------------------
------^^
this is two single quotes. It's an if-then-else construction. The else
needs to be an empty string.


--
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
==================

"zu" <webforumsuser@macromedia.com> wrote in message
news:cfido3$rsm$1@forums.macromedia.com...
> Thank you Murray
>
> This seems to be the perfect solution
> ... but for some esoteric reasons it just doesn't seem to work.
> I can't see exactly where you use single quotes and where double quotes.

This
> was one of the possible reasons it didn't work. After changing in several

ways
> and soing some typos from time to time, I get quiet frustrated because

again
> and again I get a silly error.
>
> It went from "unbalanced quotes or missing attribute" to "@@(...)@@
> directives cannot be used inside editable regions" to something like
> "unterminated string" etc.
>
> All reasonable error messages but really I can't see the obvious typo(s).
>
> Maybe some other eyes can see it.
>
> The actual error with the following code is :"There is an error at line

73,
> column 1 (absolute position 2050) of

"D:\Websites\mcweb\Templates\default.dwt":
> @@(...)@@ directives cannot be used inside editable regions", which

doesn't
> seem to make sense in my humble opinion.
>
> Do you see, where I made a mistake?
> I think I give up before my holidays.
>
> Here the code:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"

/>
> <meta name="author" content="Christian Zumbrunnen" />
> <!-- TemplateBeginEditable name="doctitle" -->
> <title>mc web - unkomplizierte Internet & PC Dienstleistungen</title>
> <!-- TemplateEndEditable -->
> <style type="text/css" media="screen">
> @import url(../css/default.css);
> </style>
> <!-- TemplateParam name="aktivesmenu" type="text" value="startseite" -->
> <!-- TemplateBeginEditable name="head" -->
>
> <!-- TemplateEndEditable -->
> </head>
> <body>
> <div id="container">
> <p class="skipLink"><a href="#startContent" accesskey="2">Zum

Hauptbereich
> wechseln</a></p>
> <hr class="hidden" />
> <div id="branding"> <img src="../images/mcweb-logo.gif" alt="mc web

Logo"
> width="336" height="118" hspace="5" vspace="5" />
> <!-- <h1 id="title">mc web</h1> -->
> </div>
> <!-- end of #branding -->
> <!-- <p id="tagLine">Web Design Techniques And Other Assorted

Ramblings</p>
> -->
> <!-- TemplateBeginEditable name="breadcrumb" -->
> <div id="breadcrumb"> Startseite / </div>
> <!-- TemplateEndEditable -->
> <div id="mainBody">
> <div id="tools">
> <div class="menu">
> <h2>Inhalt</h2>
> <li><a href="index.htm"
> @@(aktivesmenu=="startseite"?'class='current'':")@@>Startseite
> @@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
> hier</em>]</span>':"@@</a></li>
> <li><a href="leistungen.htm"
>

@@(aktivesmenu=="startseite"?'class='current'':")@@>Serviceleistunge
n
> @@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
> hier</em>]</span>':"@@</a></li>
> <li><a href="preise.htm"
> @@(aktivesmenu=="startseite"?'class='current'':")@@>Preise
> @@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
> hier</em>]</span>':"@@</a></li>
> <li><a href="produkte.htm"
> @@(aktivesmenu=="startseite"?'class='current'':")@@>Hard- &
> Software @@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
> hier</em>]</span>':"@@</a></li>
> <li><a href="kontakt.htm"
> @@(aktivesmenu=="startseite"?'class='current'':")@@>Kontakt
> @@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
> hier</em>]</span>':"@@</a></li>
> <ul class="navigation">
> </ul>
> </div>
> <div class="menu">
> <h2>Angebote</h2>
> <ul class="articleList">
> <li><a href="http://#">Angebot 1</a></li>
> <li><a href="http://#">Angebot 2</a></li>
> </ul>
> </div>
> </div>
> <!-- end of #tools -->
> <div id="mainContent">
> <!-- TemplateBeginEditable name="mainContent" -->
> mainContent
> <!-- TemplateEndEditable -->
> <p class="clear"></p>
> </div>
> <!-- end of #mainContent -->
> </div>
> <!-- end of #mainBody -->
> <div id="pageInfo">
> <div id="license">
> <p> <img src="../images/mcweb-46.gif" width="46" height="46"

vspace="5"
> /> Christian Zumbrunnen<br />
> Eidg. dipl. Wirtschaftsinformatiker HF<br />
> <strong>079 784 52 37</strong> (Mo – Sa: 8:00 –

20:00)<br
> />
> <strong><a
> href="mailto:mcweb@chruezundquer.ch">mcweb@chruezundquer.ch</a></strong>

</p>
> <p class="copy">© 2004 <a href="kontakt.htm" title="Kontakt
> Informationen" accesskey="9">mc web</a></p>
> </div>
> <!-- end of #license -->
> </div>
> <!-- end of #pageInfo -->
> </div>
> <!-- end of #container -->
> </body>
> </html>
>



zu

2004-08-13, 12:16 pm

that didn't work with the code in the post.
I put the template file to
http://www.chruezundquer.ch/mcweb/Templates/default.dwt
and also attached the code in this post instead of just put it in the message
text.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Christian Zumbrunnen" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>mc web - unkomplizierte Internet & PC Dienstleistungen</title>
<!-- TemplateEndEditable -->
<style type="text/css" media="screen">
@import url(../css/default.css);
</style>
<!-- TemplateParam name="aktivesmenu" type="text" value="startseite" -->
<!-- TemplateBeginEditable name="head" -->

<!-- TemplateEndEditable -->
</head>
<body>
<div id="container">
<p class="skipLink"><a href="#startContent" accesskey="2">Zum Hauptbereich
wechseln</a></p>
<hr class="hidden" />
<div id="branding"> <img src="../images/mcweb-logo.gif" alt="mc web Logo"
width="336" height="118" hspace="5" vspace="5" />
<!-- <h1 id="title">mc web</h1> -->
</div>
<!-- end of #branding -->
<!-- <p id="tagLine">Web Design Techniques And Other Assorted Ramblings</p>
-->
<!-- TemplateBeginEditable name="breadcrumb" -->
<div id="breadcrumb"> Startseite / </div>
<!-- TemplateEndEditable -->
<div id="mainBody">
<div id="tools">
<div class="menu">
<h2>Inhalt</h2>
<li><a href="index.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Startseite
@@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<li><a href="leistungen.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Serviceleistungen
@@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<li><a href="preise.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Preise
@@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<li><a href="produkte.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Hard- &
Software @@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<li><a href="kontakt.htm"
@@(aktivesmenu=="startseite"?'class='current'':")@@>Kontakt
@@(aktivesmenu=="startseite"?'<span> [<em>Sie befinden sich
hier</em>]</span>':"@@</a></li>
<ul class="navigation">
</ul>
</div>
<div class="menu">
<h2>Angebote</h2>
<ul class="articleList">
<li><a href="http://#">Angebot 1</a></li>
<li><a href="http://#">Angebot 2</a></li>
</ul>
</div>
</div>
<!-- end of #tools -->
<div id="mainContent">
<!-- TemplateBeginEditable name="mainContent" -->
mainContent
<!-- TemplateEndEditable -->
<p class="clear"></p>
</div>
<!-- end of #mainContent -->
</div>
<!-- end of #mainBody -->
<div id="pageInfo">
<div id="license">
<p> <img src="../images/mcweb-46.gif" width="46" height="46" vspace="5"
/> Christian Zumbrunnen<br />
Eidg. dipl. Wirtschaftsinformatiker HF<br />
<strong>079 784 52 37</strong> (Mo – Sa: 8:00 – 20:00)<br
/>
<strong><a
href="mailto:mcweb@chruezundquer.ch">mcweb@chruezundquer.ch</a></strong> </p>
<p class="copy">© 2004 <a href="kontakt.htm" title="Kontakt
Informationen" accesskey="9">mc web</a></p>
</div>
<!-- end of #license -->
</div>
<!-- end of #pageInfo -->
</div>
<!-- end of #container -->
</body>
</html>

zu

2004-08-13, 12:16 pm

which doesn't seem to make sense in my humble opinion.

Ahh - but it does make sense. You cannot do such things in an editable region.
To use such methods, you would have to use them in non-editable parts of the
page.

Yes, but it is NOT within an editable region.


Murray *TMM*

2004-08-13, 12:16 pm

Oops. You are right.

Try correcting the single quote/double quote problem I mentioned, then, and
see if it likes that better.

--
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
==================

"zu" <webforumsuser@macromedia.com> wrote in message
news:cfigkc$1rg$1@forums.macromedia.com...
> which doesn't seem to make sense in my humble opinion.
>
> Ahh - but it does make sense. You cannot do such things in an editable

region.
> To use such methods, you would have to use them in non-editable parts of

the
> page.
>
> Yes, but it is NOT within an editable region.
>
>



zu

2004-08-15, 7:15 am

I had to acomplish some other things first.
Sorry, for the delay and thanks again for your help.

After correcting the single quote/double quote problem and escaping the quote
character with JavaScript escape (\") instead of with "'" it finaly
started working.

The one thing I'd like to have improved would be having a dropdownlist or
something like it for editing the template parameters (properties in DW speak)
but that seems not to be possible because only text, Boolean (true/false),
color, and URL are accepted types of editable tag attributes in a template.

So whoever edits them (with Contribute) has a chance to do a typo.

As a reference the working code (relevant part) is attached.


<ul class="navigation">
<li>@@(aktivesmenu=="startseite"?'<a class=\"current\">':'<a
href=\"index.htm\">')@@Startseite@@(aktivesmenu=="startseite"?'<span> [<em>Sie
befinden sich hier</em>]</span>':'')@@</a></li>
<li>@@(aktivesmenu=="leistungen"?'<a class=\"current\">':'<a
href=\"leistungen.htm\">')@@Serviceleistungen@@(aktivesmenu=="leistungen"?'<span
> [<em>Sie befinden sich hier</em>]</span>':'')@@</a></li>

<li>@@(aktivesmenu=="preise"?'<a class=\"current\">':'<a
href=\"preise.htm\">')@@Preise@@(aktivesmenu=="preise"?'<span> [<em>Sie
befinden sich hier</em>]</span>':'')@@</a></li>
<li>@@(aktivesmenu=="produkte"?'<a class=\"current\">':'<a
href=\"produkte.htm\">')@@Hard- &
Software@@(aktivesmenu=="produkte"?'<span> [<em>Sie befinden sich
hier</em>]</span>':'')@@</a></li>
<!-- <li>@@(aktivesmenu=="woerterbuch"?'<a class=\"current\">':'<a
href=\"dict.htm\">')@@Wörterbuch@@(aktivesmenu=="woerterbuch"?'<span>
[<em>Sie befinden sich hier</em>]</span>':'')@@</a></li> -->
<li>@@(aktivesmenu=="kontakt"?'<a class=\"current\">':'<a
href=\"kontakt.htm\">')@@Kontakt@@(aktivesmenu=="kontakt"?'<span> [<em>Sie
befinden sich hier</em>]</span>':'')@@</a></li>
</ul>

Murray *TMM*

2004-08-15, 12:15 pm

Excellent!

> because only text, Boolean (true/false),
> color, and URL are accepted types of editable tag attributes in a

template.

Add "number" to the list. There are 5 types of parameters.

> So whoever edits them (with Contribute) has a chance to do a typo.


Any time there is free text entry this is always the possibility. You can
suggest things directly to the development team, however -

http://www.macromedia.com/go/wish/


--
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
==================

"zu" <webforumsuser@macromedia.com> wrote in message
news:cfmcsa$6qu$1@forums.macromedia.com...
> I had to acomplish some other things first.
> Sorry, for the delay and thanks again for your help.
>
> After correcting the single quote/double quote problem and escaping the

quote
> character with JavaScript escape (\") instead of with "'" it finaly
> started working.
>
> The one thing I'd like to have improved would be having a dropdownlist or
> something like it for editing the template parameters (properties in DW

speak)
> but that seems not to be possible because only text, Boolean (true/false),
> color, and URL are accepted types of editable tag attributes in a

template.
>
> So whoever edits them (with Contribute) has a chance to do a typo.
>



Sponsored Links


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