Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
So, this is scenario I have.

1. Services page - on this page I have list of few services that are created in CMS admin.
2. Work page - here is few work samples and those samples have their different folders. Also created in CMS admin.

Now I want to attach some work samples to the detailed page of services. Let's say the service is "Design", and in work samples there are few samples with folder "Photoshop". I want to show only those work samples with "photoshop" folder selected. On other detailed service page (etc. "Coding), I want to show work sample with some other folder.

How to do that? Is it possible to do it with "if" condition? For example if URL is ../design.html, show work samples with "photoshop" folder.
If there is a well established relation between design pages and work folders, you may use a hardcoded <cms:if><cms:else_if /> block to figure out the folder name and then use it with the <cms:pages> block doing the listing.

If, however, the relation needs to be set within the admin-panel, then create a dynamic dropdown (viewtopic.php?f=4&t=1671&p=2483#p2483) in design template showing work folders. Each design page can be linked to a particular folder. On the frondend, use the value selected in the dropdown to use with <cms:pages>.

Hope the reply helps.
I managed to do it. Here is solution, maybe someone will need it..

Code: Select all
<cms:if k_page_foldername="marketing">
<cms:pages masterpage="services.php" limit="5" folder="marketing">
.....(your html code)....
</cms:pages>
<cms:else />
<cms:if k_page_foldername="commercial">
<cms:pages masterpage="services.php" limit="5" folder="commercial">
.....(your html code)....
</cms:pages>
<cms:else />
<cms:pages masterpage="services.php" limit="5">
.....(your html code)....
</cms:pages>
</cms:if>
</cms:if>
Thanks.
As an optimization, you may use the following variation -
Code: Select all
<cms:if k_page_foldername='marketing' >
    <cms:set my_folder='marketing' />
<cms:else_if k_page_foldername='commercial' />
    <cms:set my_folder='commercial' />
<cms:else />
    <cms:set my_folder='' />
</cms:if>

<cms:pages masterpage="services.php" limit="5" folder=my_folder>
.....(your html code)....
</cms:pages>

Further, if there is a one-to-one correspondence between the current page's folder ,(k_page_foldername) and the folder of 'services.php', you may simply use the following (note how we are setting the 'folder' param directly using 'k_page_foldername' -
Code: Select all
<cms:pages masterpage="services.php" limit="5" folder=k_page_foldername>
.....(your html code)....
</cms:pages>

Hope this helps.
4 posts Page 1 of 1
cron