I’m sure there’s really something simple I’m missing, so I’m sure this’ll be an easy one...
I have a blog set up on my site with Ditto. Works great so far, but I’m trying to to have an image show up on the page that shows summaries of all the posts. So my ditto call looks like this:
[!Ditto? &parents=`7` &tpl=`blogtemplate` &display=`4` &paginate=`1` &paginateAlwaysShowLinks=`0` !]
[+previous+] [+pages+] [+next+]
So that’s calling a chunk (blogtemplate), with the following code:
<h3><a href="[~[+id+]~]">[+pagetitle+]</a></h3>
<p class="blog-summary">[+introtext+]</p>
<a href="[+url+]">read more ></a>
So how can I set it up so that I can have an image show for each blog post on the summary page (the page that shows the summary, title, etc). I’m sure a TV is in order, but I just can’t think of a way so that each post can have a unique image when showing on the same page.
Hope that makes sense, kinda tough to explain.
Thanks!
create a new image tv, upload image into it. Then call it in your template like [+yourimage+]
I tried that. But then you’ll have the same image for every blog summary.
Since it’s showing 4 summaries per page, I need a unique image for each summary.
Do you want a different random image for each summary, or do you need to connect a specific image with a specific summary?
A specific image. For example, if the blog post was about a Camaro, I’d have an image of a Camaro by the summary. Then if the next one was about a Mustang, that one would have a picture of a Mustang. And so on.
Thanks for the help!
I think there’s a slight confusion about the term "template" here:
What zi meant, was to add the image-TV to your chunk that serves as a template for your Ditto-call, i.e. &tpl=`chunkname`.
If you add a TV to a Ditto-tpl chunk, use placeholder syntax: [+foo+]
Adding a TV to a "regular" (document-) template needs the syntax [*bar*]
Of course, adding that image-TV to the regular template won’t do what you’re after. Add it to your Ditto-tpl-chunk instead.
Thats correct. Though if you are using latest ditto, 2.1+ you don’t need to add &hiddenFields anymore.
Just edit your blog posts, and use separate images for them. Ditto will output what you select there.
Hope it helps.
Thanks for the help! I was able to get it working.