Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
This may be a silly question, but it's been bugging me for hours now...

If I setup index.php as follows ...

Code: Select all
<cms:template clonable='1' nested_pages='1' />
<cms:editable name='content' label='Page Content' type='textarea'>
</cms:editable>


... then I can generate lots of pages. Brilliant.

My question is this - How do I now create an editable homepage?

-

Lewis
Since, I am sure, you know about the concept of views (http://www.couchcms.com/docs/concepts/views.html) in Couch, you'll understand that the home-page (e.g. http://www.yoursite.com/) is actually the 'list-view' of index.php template.

Now, because it is not a concrete page in itself we cannot directly edit anything in it.
However, there is a way-around.
A sample index.php -
Code: Select all
<cms:if k_is_page>
   <!-- Page view -->
   <h1><cms:show k_page_title /></h1>
<cms:else />
   <!-- Display home page here -->
   <cms:masquerade "http://www.yoursite.php/some-page.html" />
</cms:if>

In the code above, the list-view 'masquerades' as "http://www.yoursite.php/some-page.html". This could be any arbitrary page of you site.
So we can choose any page (or even use a separate template) and then use it as the home page. Of course, the chosen page can be edited as any other page.

Hope this helps. Do let me know.
Thanks
That does help, thanks!

Actually, I found a similar way earlier :

index.php
Code: Select all
<cms:template clonable='1' nested_pages='1' />
<cms:pages masterpage='home.php'>
  <cms:show content />
</cms:pages>


home.php
Code: Select all
<cms:template title='Home' />
<cms:editable name='content' label='Page Content' type='textarea'>
</cms:editable>


I hope this thread helps someone else.
3 posts Page 1 of 1