Hi,
below is my code, but it is wrong. can anyone give me the correct one?
<li><a href="/{path}={channel_short_name}/{url_title}">{title}</a></li>Thanks
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
December 27, 2012 9:58pm
Subscribe [3]#1 / Dec 27, 2012 9:58pm
Hi,
below is my code, but it is wrong. can anyone give me the correct one?
<li><a href="/{path}={channel_short_name}/{url_title}">{title}</a></li>Thanks
#2 / Dec 28, 2012 6:42am
You need to restate the question. I have no idea what you’re trying to do with that code, it doesn’t match the question at all.
#3 / Dec 28, 2012 3:52pm
It looks like they forgot to use code tags, I’ve updated the post so that it’s readable.
Somvannda, try updating your link to read like this:
<a href="{path='{channel_short_name}/{url_title}'}">#4 / Dec 28, 2012 4:13pm
I don’t believe you can do that. The path function requires a template_group and template, you’re using variables.
You can use variables, in fact, it’s how I frequently build links, but don’t use path. You’d want to build the url like…
<li><a href="/{channel_short_name}/{url_title}">{title}</a></li>using relative path, or using explicit path like
<li><a href="http://{site_url}/{channel_short_name}/{url_title}">{title}</a></li>I’m going to assume your channel short_names match a template group name. If not that’s a different ballgame. But if they do, then you are basically shooting for a single link code that can work pulling multiple templates, like if your home page pulled from three or four sections, say: books, research, events, news. Then you’d do a single channel:entries pull referencing channels=“books|research|news|events” and return results that look like below…
<li><a href="http://mydomain.org/news/the-world-surprisingly-didnt-end">The World Didn't End</a></li>
<li><a href="http://mydomain.org/books/classic-shell-scripting">Classic Shell Scripting</a></li>
<li><a href="http://mydomain.org/research/github-works">Github Works</a></li>
<li><a href="http://mydomain.org/event/smacss-the-css">SMACSS the CSS: For Newbies</a></li>if all that’s true, then you can use
<li><a href="http://{site_url}/{channel_short_name}/{url_title}">{title}</a></li>