Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
I have a following situation, i'm displaying some information from the template by using the pages tag on a list.
The list has an anchor and image inside it.It is used to display different project pages.
Link is no problem-k_page_link and it is fine, but i have a problem with displaying image.

Since there is no data associated with the image in the template, i was wondering if there is a way of putting image, and still keeping the usability of pages tag?
cms:pages tag, apart from the system variables like the k_page_link you mentioned, also makes available the data contained within all editable regions of the pages it fetches.
For example, if suppose your clonable 'portfolio.php' template has two editable regions - 'my_text' and 'my_image', the following snippet will print out the data belonging to each cloned portfolio page -
Code: Select all
<cms:pages masterpage='portfolio.php'>
   <cms:show my_text /><br />
   <cms:show my_image /><br />
</cms:pages>

For the situation that you have, if the image is handled via an editable region in the portfolio template, you can access the data (i.e. the image's link) as shown in the snippet above.
Your list could become -
Code: Select all
<ul>
   <cms:pages masterpage='portfolio.php'>
      <li>
         <a href="<cms:show k_page_link />"><img src="<cms:show my_image />" /></a>
      </li>
   </cms:pages>
</ul>

where 'my_image' can be substituted by the name of the relevant editable region.

If, however, you are not using editable regions, I am afraid Couch then has no way of finding out the contents of a page.

Hope this helps.
Thanks KK,
I was aware of everything you wrote.The image that i would need to put in has no connection with the template, but this has crossed my mind:
Let's say that i declare editable region of type image in the template and than use css to pull it off the screen, would i be able to use that image source in my pages tag?
Let's say that i declare editable region of type image in the template and than use css to pull it off the screen, would i be able to use that image source in my pages tag?

Theoretically - yes.
Practically - if you hide the region by moving it off screen from the admin panel, how do you plan to select any image into it?
Please let me know.
No, i don't need to hide it from admin panel.I just need a way to put an image into clonable template, the only thing is that i don't want that image to be visible on cloned pages.

I need it for different purposes, it is part of my list on which i am using pages tag.
So this way the image would be in the cloned template, just pulled off the screen with css.

And then i can use it's source in my pages tag to display it where i want it to be.
OK, sorry I misunderstood.

To do what you are trying to, you do not need to use CSS at all to hide the image (i.e. output of the editable region).
You can simply not output the image in the first place.

Two ways of doing it -
1. Declare the editable region within the <cms:template> tag. This tag has no output of its own and thus hides all editable regions defined within it from the webpages (of course not from the admin panel).
2. Use the 'hidden' parameter of the editable region e.g.
<cms:editable name="my_image" type="image" hidden="1" />


Hope this helps.
Sure it helps, thanks a lot.
7 posts Page 1 of 1