related entries : How get the entry_id value
Posted: 03 November 2007 06:12 AM   [ Ignore ]
Newbie
Rank
Total Posts:  15
Joined  2007-08-07

Hello,
Here is my code

{exp:weblog:entries weblog="web" orderby="edit_date" sort="desc" limit="1" category="4"}
<h1>{title}</h1>
{text}
<div class="tagsarticle">
{exp:tag:tags entry_id="{entry_id}" backspace="1" type="weblog" orderby="clicks" sort="desc" limit="10"}
<a href="{path=site/tags/tag}{websafe_tag}" title="{tag_name}" >{tag}</a> |
{/exp:tag:tags}
</div>
{/exp:weblog:entries}

<div class="tagsrelated">
<
h3>Related</h3>
<
ul>
{exp:tag:related_entries  limit="10" entry_id="{entry_id}" }
<li><a href="{url_title_path=site/articles/}">{title}</a></li>
{/exp:tag:related_entries}
</ul>

Works fine if entry_id is an url segment.

If I call the template directly , entry_id is not in the url. entry_id is visible in the weblog entries loop and not visible in tag related_entries.
How get the entry_id value in the tag related_entries loop ?

I try to put the related_entries loop in the weblog entries loop, but I get here x time the same URL.
Thanks for the help.

Note : I have PHP parsed at input.

Profile
 
 
Posted: 14 November 2007 11:28 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3716
Joined  2006-10-18

If you’re looking to just link to the entry with the permalink ID, use this:

<a href="{permalink="templategroup/template"}">

 Signature 

Check out the new Solspace Blog!

Profile
 
 
Posted: 14 November 2007 12:14 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  15
Joined  2007-08-07

Thanks for the answer.
It’s not the problem : related_entries don’t work if I call the template like this : www.mysite.com/index.php/templategroup/template
because entry_id is empty. entry_id is filled when a segment of the url is the article id like : www.mysite.com/index.php/templategroup/template/28.

When, I call the template without article number, the last article si displayed on the page. entry id is there in the weblog entries loop.
I need it a few lines below, in the related entries loop !
My question : how transfer entry_id from weblog entries loop to the related entries loop ?
Note : I use php on the template, parsed at begining.

Profile
 
 
Posted: 14 November 2007 12:41 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3716
Joined  2006-10-18

I don’t believe it’s possible… easily anyway.

However, I did find a dirty workaround in the change you are perhaps referring to a template that is pulling a SINGLE entry onto that page:

{exp:weblog:entries weblog="{my_weblog}" limit="1"}
{title}
<br />
Related: {exp:tag:related_entries entry_id="{entry_id}" dynamic="off" limit="3"}
{
/exp:weblog:entries}
<a href="{permalink="template_group/template"}">{title}</a><br />{/exp:tag:related_entries}<br /><br />

Good luck!

 Signature 

Check out the new Solspace Blog!

Profile