Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Greetings to all!

I am trying to do a FAQ section for a site.

Till now I have implemented the entire BLOG section from the documentation. I am now looking forward to achieve the following:

1. Folders => Categories
2. Pages => Questions

When a user visits a particular question I want to show him, on that visited question page, the other question related to the same category in the sidebar. I tried something like this:

Code: Select all
<cms:folders>

       <cms:pages masterpage='faq.php' folder=k_folder_name>
       <li><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></li>
        </cms:pages>

</cms:folders>


the above code rendered the output by displaying all the questions, irrespective of their category.

What needs to be done?

Regards,
GenXCoders
Image
where innovation meets technology
Hi Aashish,

When a user visits a particular question I want to show him, on that visited question page, the other question related to the same category in the sidebar
So basically we are in a page-view and wish to show other pages belonging to the *folder of the current page*.

Do a cms:dump on the page and you'll find that the variable holding the name of the mentioned folder is 'k_page_foldername'.

So the following code should do it (I don't think you need the <cms:folders>)
Code: Select all
<cms:pages masterpage='faq.php' folder=k_page_foldername>
       ..
</cms:pages>

If you wish to exclude the current page from the listing, amend the code to this -
Code: Select all
<cms:pages masterpage='faq.php' folder=k_page_foldername id="NOT <cms:show k_page_id />">
       ..
</cms:pages>

Hope this helps.
Dear KK Sir it worked like a charm.

Also I removed the <cms:folders> tag because the tag was repeating the entire list of pages according to the number of categories (folders).

Sir I am facing a problem with the embed tag. This is for the first time ever.

Code: Select all
<body>
       <!-- ========== Navigation Menu ========== -->
        <nav class="clearfix">
            <cms:embed 'header.html' />
            <a href="#" id="pull">&#9776; Menu</a>
        </nav>
        <!-- ========== Navigation Menu ========== -->
<


I used the <cms:embed 'header.html' /> as always but it is giving the following error.
ERROR! ATTRIB_NAME: Invalid char "." (line: 60 char: 28)

This error is prevailing on on pages.
I have used the <cms:embed 'some_value.html' /> in the faq page and the products page also. There are no errors there.

Please advise.

Regards,
Aashish
Image
where innovation meets technology
:oops: silly mistake by me. I did not enclose the index.php page in quotes in the header.html file in the line:

Code: Select all
<cms:link 'index.php' />


and hence this error occurred.

Regards,
Aashish.

genxcoders wrote: Dear KK Sir it worked like a charm.

Also I removed the <cms:folders> tag because the tag was repeating the entire list of pages according to the number of categories (folders).

Sir I am facing a problem with the embed tag. This is for the first time ever.

Code: Select all
<body>
       <!-- ========== Navigation Menu ========== -->
        <nav class="clearfix">
            <cms:embed 'header.html' />
            <a href="#" id="pull">&#9776; Menu</a>
        </nav>
        <!-- ========== Navigation Menu ========== -->
<


I used the <cms:embed 'header.html' /> as always but it is giving the following error.
ERROR! ATTRIB_NAME: Invalid char "." (line: 60 char: 28)

This error is prevailing on on pages.
I have used the <cms:embed 'some_value.html' /> in the faq page and the products page also. There are no errors there.

Please advise.

Regards,
Aashish
Image
where innovation meets technology
4 posts Page 1 of 1