-
- 16 Posts
Apologies in advance for what may be a really stupid question, but I’ve searched the forums up and down for a way to access a specific post in the list that NewsListing returns.
By that I mean this:
When you use NewsListing you get back a list of posts/articles depending on the parameters you enter in the "search". Say you request the eight last posts in the folder ’News’. How do you access a specific post in that list, say post #9?
What I want to do is to add a bit of randomness to the display of posts:
+--+--+--+--+
| 1 | 2 | 3 | 4 |
+--+--+--+--+
| 5 | 6 | 7 | 8 |
+--+--+--+--+
Each number in the table represents a space for a post. In reality ( with my randomness) I’d like to place posts in each holder. Say like this:
+--+--+--+--+
| P7 | P3 | P5 |P1|
+--+--+--+--+
| P6 | P2 | P4| P8 |
+--+--+--+--+
For that I would need to know how to access a specific post, and put placeholders in a chunk according to my randomness routine. Say I want the routine to write the 3rd place in the top line.
<div id="P5">
<p>[+Longtitle(5)+]</a> (i.e. the long title for post numer 5 in the returned list)
<p>[+summary(5)+]</p> (i.e. the summary for post number 5 in the returned list)
</div>
Thanks in advance!
-
- 3,250 Posts
The way NewsListing currently works, this would not be possible as it uses a repeating template.
The way you describe it is possible but would require quite a bit of coding.
I could do something similar with much fewer lines of code. Tell me what you think of this: You could have [+item#+] placeholders for each post and could put them wherever you want. These would use the &tpl for code formatting.