Problems, need help? Have a tip or advice? Post it here.
16 posts Page 2 of 2
@All:

I have done the following changes:

Code: Select all
<cms:pages masterpage='business.php' folder=k_folder_name limit='45' paginate='1'>
     <div class="col-1-4">
          <div class="content">
               <div id='parent_div_1'>
          <cms:folders masterpage='business.php'>
               <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_page_foldertitle /></a>
          </div>
                    </cms:folders>
          </div>
               <div style="padding-bottom: 20px;"></div>
     </div>
     </div>
     <cms:paginator />
</cms:pages>


The folder images are showing up on the front page but each image is repeated in a row thrice and the names of the folder are not appearing correctly.

Please advise.
Image
where innovation meets technology
genxcoders wrote: @All:

I have done the following changes:

Code: Select all
<cms:pages masterpage='business.php' folder=k_folder_name limit='45' paginate='1'>
     <div class="col-1-4">
          <div class="content">
               <div id='parent_div_1'>
          <cms:folders masterpage='business.php'>
               <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_page_foldertitle /></a>
          </div>
                    </cms:folders>
          </div>
               <div style="padding-bottom: 20px;"></div>
     </div>
     </div>
     <cms:paginator />
</cms:pages>


The folder images are showing up on the front page but each image is repeated in a row thrice and the names of the folder are not appearing correctly.

Please advise.



Hi genxcoders,

I believe that your <cms:folders> tag needs to be wrapping around the <cms:pages> tag and NOT the other way around.

To clarify, try this:

Code: Select all
<cms:folders masterpage='business.php'>
<cms:pages masterpage='business.php' folder=k_folder_name limit='45' paginate='1'>
     <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_page_foldertitle /></a>
          </div>
                   
          </div>
               <div style="padding-bottom: 20px;"></div>
     </div>
     </div>
     <cms:paginator />
</cms:pages>
</cms:folders>

EDIT: Also, to help clear up why this is needed, place <cms:dump> inside the <cms:folders> BEFORE the <cms:pages> and then place another inside of <cms:pages> and you should see that each output inside of <cms:pages> is in the correct folder.

The folder="k_folder_name" parameter of the pages tag cannot call the correct folders if it's not within the <cms:folders> tag. The way you had it the pages tag isn't calling folders (do <cms:dump> within the pages tag BEFORE the <cms:folders> tag and you'll see that the folder variables are not correct.

having folders wrap around everything shouldn't affect your output at all, it just makes available the folder variables you're trying to use.

I hope this helps, please let me know.
Image
@genxcoders,

You are unnecessarily combining two different tags - there is no need to nest cms:pages and cms:folders in your case.
This should be your normal listing -
Code: Select all
<cms:pages masterpage='business.php' folder=k_folder_name limit='45' paginate='1'>
     <div class="col-1-4">
          <div class="content">
            <div id='parent_div_1'>
                <!-- show page info here -->
            </div>
            <div style="padding-bottom: 20px;"></div>
     </div>
     </div>
     <cms:paginator />
</cms:pages>

Place the following somewhere (perhaps in the sidebar) to lead to the listing above -
Code: Select all
<!-- show links to the folder-view here -->
<cms:folders masterpage='business.php'>
    <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_page_foldertitle /></a>
    </div>
</cms:folders>
@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.
Image
where innovation meets technology
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.html

If 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. :)
Image
@Bartonsweb:

Sure thing. I am giving it a try and will revert to you...

Regards,
Aashish
Image
where innovation meets technology
16 posts Page 2 of 2
cron