Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Sorry to be bugging you with questions. I've created my portfolio website, have a look at it here: http://agoberg.tv/

Everything is working great now, and its no problem for me to update the portfolio section and the blog. The thing is, on the main page all the links are going to a separate page (with a video), but I would also like to be able to put photographs on the first page, and I want to have those photographs to open in a lightbox window.

My current code is as follows:
Code: Select all
<cms:pages masterpage='index.php' limit='18' >
   <div class="imgteaser">
   <a href="<cms:show k_page_link />"><img src="<cms:show portfolio_image />" width="150" height="150" alt="<cms:show k_page_title />" />
   <span class="desc"><h2><cms:show k_page_title /></h2><br />
   <cms:show portfolio_type /></span></a>
   </div><!-- imgteaser end --> 
</cms:pages >


Would it somehow be possible for the <a href="<cms:show k_page_link />"> to change to just link to a image if that image exists? Another problem is that the lightbox window need a rel="" code in the anchor tag as well. I know I could probably use the if/else functions, but I don't really understand how that works. Hope you understand my question..

Another thing, I'm planning to buy a licence for Couch, when I do would I have to do a new installation of Couch or just change a licence file?

Thanks for your help...
Hey Datsun, please feel free to ask us any question that stumps you :)

Replying to your question, yes you are right - a simple if/else is what is required.
But first we must have an editable region for the image that is to be shown (actually two - we'll create an associated thumbnail also).

So in addition to the editable regions that you already have for the video etc., create an editable region of type 'image' and another associated with it of type 'thumbnail'.
Let us suppose the name of the 'image' is 'my_image' and that of the thumbnail is 'my_image_thumb'.
In our code we'll first check if the region 'my_image' has any content.
If it has, the image's thumbnail will be displayed which will link back to the main image (and will have the "rel" attribute so that the image opens in a lightbox).
If there is no content within it, the original code that links to the video pages is shown.

Here is what it could look like -
Code: Select all
<cms:pages masterpage='index.php' limit='18' >
   <div class="imgteaser">
      <cms:if my_image>
         <a href="<cms:show my_image />" rel="lightbox"><img src="<cms:show my_image_thumb />" width="150" height="150" alt="<cms:show k_page_title />"></a>
      <cms:else/>
         <a href="<cms:show k_page_link />"><img src="<cms:show portfolio_image />" width="150" height="150" alt="<cms:show k_page_title />" />
      </cms:if>
      <span class="desc"><h2><cms:show k_page_title /></h2><br />
      <cms:show portfolio_type /></span></a>
   </div><!-- imgteaser end -->
</cms:pages>

Hope this helps. Do let me know.

P.S. As for the license, you simply need to overwrite the existing free license on a site with the commercial one for it to take effect.
Thanks a lot, that works like a charm. I only needed to create one more editable region as I had a region for a thumbnail from before.

Thanks for a awesome CMS, and great support :)
3 posts Page 1 of 1