Problems, need help? Have a tip or advice? Post it here.
13 posts Page 1 of 2
Hello,

I've been wrapping my head around for the last couple of days to find a solution for the following problem but I'm looking into the wrong direction. :(

I'm building a website that is structured like this
Code: Select all
homepage
- folder A
-- blog A
-- who A
-- what A
-- contact A
- folder B
-- blog B
-- who B
-- what B
-- contact B


The homepage has two links, clicking them shows a blog.
This works when I set the masterpage to blog...but when I click on one of the other links inside the selected folder a list view shows up with also the content of the other folder.

Code: Select all
<cms:folders masterpage='blog.php'>
    <li <cms:show k_folder_name />>
        <a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a>
    </li>
</cms:folders>


The other and preferred option would be to use a seperate file (menu.php) create a snippet and embed the snippet in every page. I've created this but then the links always point to websitename.com/menu.php?f=...

What can't I see that seems to be so simple to archieve but so hard to reach?
Hi Gizmo,

I am sorry but I couldn't get the full picture by your description alone.
homepage
- folder A
-- blog A
-- who A
-- what A
-- contact A
- folder B
-- blog B
-- who B
-- what B
-- contact B
Are all the above folders? If so of which template?
The homepage has two links, clicking them shows a blog.
Where do the two links point to?

Please put aside all solutions for the time-being and describe the problem in full.
Post some mock screenshots.

Thanks.
Thanks for the quick response.

I've included some screenshots that show the menu structure

http://www.shapeshift.nl/screenshots/mainmenu.jpg
http://www.shapeshift.nl/screenshots/pageresult-clicking-blue-mainmenu-item.jpg
http://www.shapeshift.nl/screenshots/pageresult-clicking-green-mainmenu-item.jpg
http://www.shapeshift.nl/screenshots/pageresult-when-clicking-blognav-inside-green-submenu.jpg

I've made 4 different masterpage templates (Blog / Who / What / Contact) with inside two folders named "Centrum Centrum-West" and "Landweert."

Code: Select all
homepage (page)
- folder A (dynamic folder)
-- blog A (cloned page from masterpage blog.php)
-- who A (cloned page from masterpage who.php)
-- what A (cloned page from masterpage what.php)
-- contact A (cloned page from masterpage contact.php)
- folder B (dynamic folder)
-- blog B (cloned page from masterpage blog.php)
-- who B (cloned page from masterpage who.php)
-- what B (cloned page from masterpage what.php)
-- contact B (cloned page from masterpage contact.php)


Right now the links on the index.php points towards blog.php of each folder.

What I try to achieve is a single menu with a repeatable folder structure each containing blog, who, what and contact in such way that when you are inside a folder clicking a menu-item only shows the content of this folder. (like the structure of a multi-language website)

I hope you get the picture.
Gizmo,
This is not the way dynamic folders work. Dynamic folders are tied to a single clonable template. For instance, you have blog.php which is a clonable template. When you activate dynamic folders in that template, the client can then create folders and assign pages of that template to different folders. It allows the client to organize pages into categories.

There is certainly a way to accomplish what you want, but let me ask. Are folder A and folder B all you need, or do you need to be able to create new folders C, D, E, etc. on the fly?
I've already thought so. :(

No, folder A and B are the first two of 10 in total.
Be able to create new folders on the fly is something that's needed.

Is this possible without cluttering the backend with multiple templates inside a seperate folder?
Like any problem there are many ways to approach this. Here is one solution.

You have 2 different types of content for each folder.
1. A blog which will have multiple instances added over time.
2. Fixed content (who, what, contact). There is only one instance of each per folder.

So what I might suggest is to create 2 clonable templates, one for blog content and one for fixed content.

For this example let us say that the site is for a school with multiple campuses. In the blog template you create a dynamic folder for Campus A, Campus B, Campus C, etc. When Campus C creates a blog post, they assign it to the Campus C folder. All blog posts are in the same template, but assigned to separate folders. Clear?

Your other template contains editable regions for all of the other data. The who, what, and contact information. If needed, you can use the group tag or message tag to help organize the information within the template so it's not overwhelming.

You don't really need folders for this template. Just create a cloned page for each campus. Name them Campus A, Campus B, Campus C, etc. so you have a naming convention to easily associate the blog posts with the correct page.

Now all of your information is tidy and clearly associated with each campus. Showing it on the front end is another thing, but quite simple. If you need help, you can continue asking.

Does this plan serve your needs?
@tim
Your solution makes sense to me and I get the picture how this can work.
I'm going to reproduce your idea tomorrow and if I have more questions I know where to ask them.
I guess I've been focussing too much on the wrong use of folders.

Thanks for taking your time to clear up my mind. I appreciate your help! :P
Hey Gizmo. I was thinking about your site a little more. The problem with my solution is that it doesn't give you the folder structure that you want in your URL, "like a multi-language site."

What you want is: myschool.com/CampusA/blog/this-story.html

This solution gives you: myschool.com/blog/CampusA/this-story.html

It's not too bad, but not exactly what you wanted. The thing to remember is that the front end templates that display your pages don't have to be the same templates that collect the data on the backend. Using Couch variables you can pull data from any template and display it in another.

So you can create the structure you want with separate hidden templates in real folders on your website. They can pull data from the tidy templates in your admin panel. The drawback would be that the client can't add new folders without the help of the designer to add new templates to the site.
Tim,

I've managed to create a structure with two clonable templates one for the news and one for everything else.

Inside the fixed content template I'm using a repeatable list like this http://www.couchcms.com/forum/viewtopic.php?f=4&t=8032&p=13723&hilit=adverts#p13723 and relations to show the content from 3 other pages inside this one template.

How to display the "who" "what" and "contact" based on the menu selection?

My menu looks like this:
Code: Select all
<nav>
    <ul>
        <li>
            <a href="index.php">
                <img src="<cms:show k_site_link />img/logo.svg" alt="logo">
            </a>
        </li>
        <li>
            <cms:show k_page_title />
        </li>
        <li><a href="<cms:link 'news.php' />"<cms:if k_template_name=='news.php'> class="selected"</cms:if>>News</a></li>
        <li><a href="<cms:link 'campus.php' />"<cms:if k_template_name=='campus-members.php'> class="selected"</cms:if>>Who</a></li>
        <li><a href="<cms:link 'campus.php' />"<cms:if k_template_name=='campus-activities.php'> class="selected"</cms:if>>What</a></li>
        <li><a href="<cms:link 'campus.php' />"<cms:if k_template_name=='campus-contact.php'> class="selected"</cms:if>>Contact</a></li>
    </ul>
</nav>


The content on the page with the fixed content looks like this:
Code: Select all
<section>
    <!-- WHO ARE WE  -->
    <cms:embed 'who.html' />
    <!-- WHAT WE DO -->
    <cms:embed 'what.html' />
    <!-- CONTACT FORM -->
    <cms:embed 'contact.html' />
</section>


Thanks again for your help.
I got it almost working with hidden templates inside a real folder.
Inside this folder I've created 4 pages

    news.php
    who.php
    what.php
    contact.php

By using
Code: Select all
<cms:pages masterpage='campus.php' order='asc'>
   <cms:if k_page_name='campus-a'>
      show content
   </cms:if>
</cms:pages>

...I'm able to show the content per page based on the page_name.
Now the only thing that's left is to have the menu item selected based on the visited page.
13 posts Page 1 of 2