Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi! i´m creating a blog page which in the page view needs a "related post" section.
I have already created the section but i realize sometimes the same post is been viewed appears in the section, i would like to exclude it from this list of related posts, i have tried:

Code: Select all
<cms:pages masterpage="blog.php" folder="<cms:show k_page_foldername />" id='NOT <cms:show k_page_id /> ' limit="4">
            <a href="<cms:show k_page_link />"><img src="<cms:show image />" class="img-responsive"></a>
          </cms:pages>


and tried too with
Code: Select all
id='NOT "<cms:show k_page_id />" '
enclosing the tag within quotes but none of them works. It do works if i manually put the id of the page but i want to make it dynamic any help?
I always find the following quote from the documentation (docs/concepts/setting-parameters.html) about parameters to be very helpful:
If single quotes are used, Couch considers the parameter's value to be an explicit value.
If double quotes are used, Couch considers the value to be either an explicit value OR the output from a nested tag.
If no quotes are used, Couch considers the value to be a variable.

The original 'pages' tag was:
Code: Select all
<cms:pages masterpage="blog.php" folder="<cms:show k_page_foldername />" id='NOT <cms:show k_page_id /> ' limit="4">

We can write this more optimally however, based on the documentation's guidelines:
Code: Select all
<cms:pages masterpage='blog.php' folder=k_page_foldername id="NOT <cms:show k_page_id/>" limit='4'>

Following up on the 'related' aspect of this code... Have you considered instead using the relationships feature (docs/concepts/relationships.html)? This way you could actually manually select which four posts you want to be displayed rather than it always being the most recent posts from the same folder.
Ok that certainly solved the problem and i´ll take a look at the relationships documentation thank U!
3 posts Page 1 of 1
cron