I think the answer is implicitly in the post with the solution. It's probably because you used double quotes instead of single quotes, which has probably killed the parsing of the code since you are using double quotes in your HTML maybe.
Alright.. Would that be considered a bug, the Umbraco crew should be notified of, or is it ligitimate enough, that the parsing breaks when using double quotes in my situation?
It isn't a bug per se, but a requirement of every programming language I'm familiar with... you must distinguish levels of quotes to avoid confusion.
In your case, you've already opened a single quote for the title=
parameter and need to use the other kind of quote marks for the fields
in the umbraco:item tag to avoid confusion about where the title=
parameter ends.
For what it's worth, it is also the case in "spoken" languages as well...
You wouldn't write... He said, "it is also the case in "spoken" languages" as well"
Rather, it would be written either as: He said, "it is also the case in 'spoken' languages as well"
or as: He said, 'it is also the case in "spoken" languages as well'.
Problem placing umbraco:item within anchor title attribute in template
Hi,
In a template, I have an anchor tag eg. <a href="/" title="">Name</a>.
When trying to place an umbraco:item within the title attribute, it's as if the templating engine does not catch the umbraco:item.
I'm guessing it's something todo with placing umbraco:item's in enclosed <>..
<a href="/" title="<umbraco:Item field="title" recursive="true" runat="server"></umbraco:Item>"><umbraco:Item field="title" recursive="true" runat="server"></umbraco:Item></a>
Which in turn outputs
<a href="/" title=""<umbraco:Item" field="title" recursive="true"></umbraco:Item>">Entered value</a>
Help? :o)
Hello Andreas,
I've tried your code with a smal change: i used single quotes instead of double quotes for the title attribute. This code worked for me:
I hope this does work for you also
Toby
Hi Toby,
Thanks, I've changed the code.
However, I'd still like to know what was/is causing the problem..
:o)
Hi Andreas
I think the answer is implicitly in the post with the solution. It's probably because you used double quotes instead of single quotes, which has probably killed the parsing of the code since you are using double quotes in your HTML maybe.
/Jan
Alright.. Would that be considered a bug, the Umbraco crew should be notified of, or is it ligitimate enough, that the parsing breaks when using double quotes in my situation?
It isn't a bug per se, but a requirement of every programming language I'm familiar with... you must distinguish levels of quotes to avoid confusion.
In your case, you've already opened a single quote for the title= parameter and need to use the other kind of quote marks for the fields in the umbraco:item tag to avoid confusion about where the title= parameter ends.
For what it's worth, it is also the case in "spoken" languages as well...
You wouldn't write... He said, "it is also the case in "spoken" languages" as well"
Rather, it would be written either as: He said, "it is also the case in 'spoken' languages as well"
or as: He said, 'it is also the case in "spoken" languages as well'.
Hope that helps clear up what's going on and why.
cheers,
doug.
Hi Doug,
Thanks!
is working on a reply...