Forum for discussing general topics related to Couch.
12 posts Page 1 of 2

Is it possible to use Couch with an one page website and what is the best way to do it? I tried a couple of things, but I didn't get all the pages correctly in the admin menu of Couch.

Any advise?

Here is some more information.

I'm working on a website for my brother. This website includes several sections, like a news page, events page, contact form, etc.


I've already some editable sections, but they all appears in one page in the admin menu, but I want them sorted like the menu of the website.

What is the best way to achieve this?

I think the best way to do this is to create a new template file for each section you would like to have in the admin panel.
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Section' executable='0' >
(editable regions here)
<?php COUCH::invoke(); ?>

You could use the following code to display the editable regions on the index page:
Code: Select all
<cms:get_custom_field 'editable_region_name' masterpage='section-name.php' />

For clonable templates such as news, you would use the pages tag instead of get_custom_field.
Thank you very much. :) I'll try this and I'll let you know if it worked.
Yes, this works very well! Thank you cheesypoof. :)
I'm almost finished with the website, but I still have no solution to the following problems.

News item
How can I show the 'news post' also in the one page template?

Contact form
How to get this work in an one page website?

Hi Martijn,

First of all, it is a good looking site you are creating :)

Replying to your question -
To display the full news (i.e. the page-view) without loading up a separate page, I think, AJAX should be the answer.
Call up news.php with the right parameters in the background via AJAX and then display the response received.

Same would go for the contact form. Use a separate template 'contact.php' and show it on your index page using AJAX. Make contact.php handle the form submission in the background through AJAX again.

Please feel free to let us know any time you find yourself requiring any help.
Thanks, but not all the credits are for me. I bought the HTML/CSS theme from and modified it to my needs and also to use with Couch.

I don't have much experience with AJAX. I'm still learning. :) But I'll do some research to figured it out.

Thanks and I'll let you know if I succeed or need some more help.
Hi Martijn, I thought I would jump in here and see if I could help. The reason your news item pages are not showing up in the template as you would like, is because they do not use the same method of linking as the rest of your sections. Lets look at your "Historie" section as an example. In the navigation bar at the top of the page, it is linked as "#section5". The way your template is built, for that page to be displayed within the template, it must be in the previously mentioned linking format, with the corresponding containing html tag using the id (the # translates to id) of "section5". If we view your page's html source, we can scroll down to the section 5 code.
Code: Select all
<div class="item" id="section5"><!-- Begin Section 5 -->
(Historie Section Content)
</div><!-- End Section 5 -->

For your news items to display the way you would like, you are going to have to follow the method that was used for the main sections like I showed above. From what I can tell, this is generally how you are going to get it to work:
Code: Select all
<cms:pages masterpage='news.php'><div class="item" id="<cms:show k_page_name />"><!-- Begin News - <cms:show k_page_name /> -->
            <div class="content">
                <div class="imgcontainer">
                    <img class="bgimg" src="img/background/1.jpg" alt="" />
                <div class="container">
                    <div class="scroll-pane">
                        <div class="grid_4">
                        <div class="grid_2">
                                                    <div class="sidebar">
                        <div class="sidebar_black">
                        <div class="sidebar">
                <a href="#" class="toggle_button"></a>
                <ul class="toggle">
                    <li><a href="#section4" class="scrollitem toggle_previous"></a></li>
                    <li><a href="#section6" class="scrollitem toggle_next"></a></li>
</div><!-- End News - <cms:show k_page_name /> --></cms:pages>

You would place all of this between these lines:
Code: Select all
        </div><!-- End Section 6 -->
*****RIGHT HERE*****
    </div><!-- End Mask -->

We can discuss the next/previous buttons if you like after you have this implemented. You are also going to have to modify the way the news items are linked from the home page to correspond to this new linking method. Use this when generating links for cloned pages such as news items:
Code: Select all
#<cms:show k_page_name />

It would be wise to place a limit on the pages tags so the number of news items being generated doesn't make your website slow to download. As KK pointed out, AJAX would be the fix for this problem. For now though the method I outlined should suffice. I hope you find my post helpful.
Thanks man! It was very helpful. I'm learning more and more. :)

It works now:

Still have to find a solution for the comment and contact form and the fix for the pagination. I'll continue this tomorrow. Thanks again and have a nice day!
12 posts Page 1 of 2

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests