genxcoders wrote: @Bartonsweb: Awesome!!!
It worked fine... All folders are now being displayed when an advert is posted into the folder...
When i click the folder (icon) and navigate to the folder, it shows to me all the posts. so m working on that now!
KK Sir, will also give a try to what you are suggesting.
When you click the folder icon you are taken to the business.php page with a url query.
An example is business.php?f=1 (this is a query for folder id 1) now in order for couch to process and output the contents of just the folder with the ID of 1 it needs to know what to show for this specific query.
I'm sure you're up to speed on the different 'views' that we have in couch.
We've used a 'list-view' on the homepage to output the folder icons and link to them.
Now we need to use a 'folder-view' you can read about the views here:
http://www.couchcms.com/docs/concepts/views.htmlIf you're using the newest version of couch (the 1.4.5 partial release) you will be able to achieve this easily with the use of 'else if' tags. However if you're on an earlier version you will need to nest your if statements so that you can use multiple views (a page-view, list-view and folder-view).
The way we do this is, as the views concept page tells you, we read the ways in which the variables are set in different views.
- Code: Select all
<cms:if k_is_page >
Page
<cms:else />
<cms:if k_is_home >
Home/List
<cms:else />
<cms:if k_is_folder >
Folder
<cms:else />
Archive
</cms:if>
</cms:if>
</cms:if>
You may not need an archive view, so you can remove the <cms:else /> from the code, but this is the way in which you'll want to use your tags to handle the views inside of business.php
Now that we have that handled, visiting business.php?f=1 will now be in a folder view. You will be able to use the <cms:pages> tag to output the pages that belong ONLY to the folder ID of 1. (or whatever ID the link has, so whichever icon is clicked on the homepage).
- Code: Select all
<cms:pages folder=k_folder_name >
<!-- each page in the folder will be listed here, output them as you like. Each pages variables will be accessible here. -->
</cms:pages>
EDIT: I thought I'd show you what the folder-view code may look like in your business.php template, I should've put the code together for you to see:
- Code: Select all
<cms:if k_is_page >
Page
<cms:else />
<cms:if k_is_home >
Home/List
<cms:else />
<cms:if k_is_folder >
<cms:pages folder=k_folder_name >
<!-- each page in the folder will be listed here, output them as you like. Each pages variables will be accessible here. -->
</cms:pages>
</cms:if>
</cms:if>
</cms:if>
As for the actual homepage - I agree with KK and the code that I used on my example of your website is this:
- Code: Select all
<cms:folders masterpage='business.php'>
<div class="col-1-4">
<div class="content">
<div id='parent_div_1'>
<a href="<cms:show k_folder_link />">
<img src="<cms:show k_folder_image />" width="80px" height="80px" />
</a>
<div style="text-align: center;">
<a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a>
</div>
</div>
<div style="padding-bottom: 20px;"></div>
</div>
</div>
</cms:folders>
I hope this helps, let me know if there's anything else or if you're stuck.