link in macro or macro in link?
Hello, couldn't solve the following: I try to read in via two macros a phrase (for instance, "Der Spiegel", without quotes) and the url "www.spiegel.de":
<% story.content part="Media" as="editor" size="24" %> <% story.content part="URL" as="editor" size="48" %>
Now, the output of the story should create a link from the phrase to the url (eg. Der Spiegel. I figured out 3 possibilities (and checked many alternatives), none works:
<a href="<% story.content part="URL" %>"> <% story.content part="Media" %> </a> or <% link to="<% story.content part="URL" %>" text="<% story.content part="Media" %>" %> or <% story.content part="Media" as="link" linkto="<% story.content part="URL" %>" %>
Did anybody come across that task?
robert
you can't nest macros as in the last two examples, however example one should work (in theory). can you post the exact code result of it?
martin_
Robert, I will figure out the coding result soon and post it along (the output is just garbage). Have you got an idea - in the meantime - to solve the problem of assigning a link to a word, both link and word are read in by story forms. Thanx. martin_
tobi Verwaltung
the first example you gave should work, theoretically. and i add that it works in practice, too (assumed you have wired everything correctly :)
martin_
sorry, the macro in href didn't work either
<a href="<% story.content part="URL" %>"> <% story.content part="Media" %> </a>
gives
http://www.spiegel.de/"> Spiegel
robert
ok, i got it: the reason why it doesn't work is the url auto detection (the content of the part URL is automatically transformed into a link). imo the only way you can circumvent this (for now) is to *not* use http:// in the URL part. example:
story part URL: spiegel.de
in the skin use
<a href="http://<% story.content part="URL" %>"><% story.content part="Media" %></a>
obviously this is a dirty hack, but after the upcoming update of www.antville.org to the latest version of antville you can use the parameter as="plaintext" within the content-macro which disables the url autodetection.
martin_
it goes this way, thanks a lot. I felt the reason somewhat because tobi wrote in one of the faq or help files that he wishes the paintext solution. At present, in my coding you would nest a href inside a href.
I am using antville 1.1 now, is "plaintext" aready implemented? And where to use: when reading input in or to output the story?
robert
antville 1.1 has the plaintext option already, so with the following macro in the story display skin (or wherever you want to embed this) it should work;
<a href="<% story.content part="url" as="plaintext" %>"><% story.content part="media" %></a>
martin_
gosh, that's great. Sorry, for being asked again, and thanks for your feedback.