URL problems
Posted: 07 September 2008 11:24 AM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  40
Joined  2007-12-14

In the code below on a single entry page, how do I construct the urls so that they point to the correct template group and entry, depending on which weblog the related entry is from? The example from the documentation is not much help, since it assumes a single weblog/template group.

<h1 class="plugheader">Relaterade artiklar</h1>
{exp:tag:related_entries weblog="artiklar|nyheter" orderby="date" sort="desc" dynamic="off" limit="10" paginate="bottom"
 
<h2><a href="{permalink="{my_template_group}/artikel"}">{title}</a></h2
 <
p>{summary}</p
 <
a href="{permalink="{my_template_group}/artikel"}">Read more</a></p
 <
p>{paginate}{pagination_links}{/paginate}</p
{/exp:tag:related_entries} 

Thanks,

/Bo

Profile
 
 
Posted: 08 September 2008 06:49 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8290
Joined  2006-10-18

Bo,

This seems to be a very common question grin

The issue is not Tag… it’s that you’re asking it to read your mind wink
Due to the flexibility of EE, Tag does not and cannot know which template you want the Entry associated with.

One of the simplest and easiest ways around this, it to name your Template Groups and your Weblog Short Names the same. You can then do this:

<h1 class="plugheader">Relaterade artiklar</h1>
{exp:tag:related_entries weblog="artiklar|nyheter" orderby="date" sort="desc" dynamic="off" limit="10" paginate="bottom"
 
<h2><a href="/{weblog_short_name}/artikel/{entry_id}/"}">{title}</a></h2> 
 <p>{summary}</p> 
 <a href="
/{weblog_short_name}/artikel/{entry_id}/">Read more</a></p> 
 <p>{paginate}{pagination_links}{/paginate}</p> 
{/exp:tag:related_entries} 

And because the url_title and permalink paths will not parse variables such as {weblog_short_name}, you have to contruct the paths “tradionally” smile

 Signature 
Profile