Problems, need help? Have a tip or advice? Post it here.
43 posts Page 3 of 5
Of course... well I already set up the site some months ago. Now that I'm implementing couch I see lots of new options :).
Since I'm not that versed in php and other "advanced" coding my options are a bit limited, but this is the way I handled my sites in the past:

I usually start with the coding/designing of one single page of the website I want to create. If the layout is done I split the html in three parts: head.html whatever.html and foot.html. I go then ahead and create the other pages for the site on basis of whatever.html.
Using php I then include head.html, foot.html and the respective html that should get displayed. This way, when I add something to the navigation, change something in the layout etc I only have to edit head.html or foot.html and the modifications apply for every page.

To have "pretty" urls I create for every page a different folder. In each is the same index.php, which loads a globalindex.php. Again to just have to change one file if I have to.

The page I'm working on was a bit tricky since it features at least two different languages. Before implementing couch each language folder contained its own content. So at first I included every folder/index.php for every language. This left me with a lot of pages in the admin panel :). Also, I had always two entries shown for every page. One featuring the german content, one the english. But I prefer to just have one entry shown in the panel, with editable regions for both german and english. Then I had the idea to create special pages for couch just to manage the content, with every page having editable regions for both languages (non-executable, since they just have the editable regions). This way I just have to determine what language the site should be shown in and load the content I need. The structure looks now as follows:

  • /_content/ - the name is confusing. Here are the html's who get the content from couch and where the layout of each page's content is determined
  • /_css/ - thats clear
  • /_php/ - holds the globalindex.php which puts each page together, some other .php's, head.html and foot.html, and all the "special couch pages"
  • /couch/ - clear
  • /de/ - the "pretty" urls for german :), with all the "dummy" folders containing the same index.php
  • /en/ - same as /de/, but for english

When now a page gets accessed, e.g. .../de/contact/ the index.php gets accessed, of course. Then globalindex.php loads and determines the language and the page that should get displayed. It includes head.html and foot.html together with contact.html from /_content/. contact.html accesses /_php/cms_contact.php - the couch file for contact - and loads the content in the selected language.

So much for short ;).

But who would I be if I wouldn't have some new questions? :)
  • When I change/delete an editable region form a clonable template it still shows when I create a new entry. I only get the "cleaned" version when I delete the template from couch and implement it again. All previous entries would be lost. Is there some other solution if I need to change a cloneable template in the future?
  • Can I have more than one comments "database"?(In the admin panel there is "users" and "comments") E.g. I have two or more different comment-forms, depending on the needs/situation. Is it possible to have an "approval page" for each different form? Or rename the existing "comments" in something different?
    I will misuse the comments option to register for seminars and it would be really nice if they could be kept seperatly :D.
  • Is it possible to create a login option on the actual page or is the only way to login through the couch index?
    I mean something like this: Login: [......] Password: [......] somewhere in the head of a page.
KK wrote:
Is there something like k_newest_page or something with wich I can access the first of the pages <cms:pages masterpage='... throws out?

Code: Select all
<cms:pages masterpage='whatever.php' limit='1'>
   ..[you get the latest page here]
</cms:pages>

I meant somethink like when limit is more than 1, is there some way to select only the top entry?

I'm asking because I have a sidebar where I list the three most recent news. Each have a link/anchor (news/#k_page_id) to their title on a page-view page(/news/). If I klick on the most recent item I get forwarded to the title where the anchor is set - of course - but it would be nicer if this would just link to /news/. The rest to /news/#id.
Have a ->look.
Thanks for taking the time to explain your site's setup.

Replying to an observation you made -
When I change/delete an editable region form a clonable template it still shows when I create a new entry. I only get the "cleaned" version when I delete the template from couch and implement it again. All previous entries would be lost. Is there some other solution if I need to change a cloneable template in the future?

You certainly do not need to delete/recreate a template everytime you change/delete an editable region.
Once you delete an editable region, for the change to be picked up by Couch simply visit the template in the "page-view" (i.e visit one of the cloned page).
Please try it out.
Replying to your question regarding creating a custom login form on any page
Is it possible to create a login option on the actual page or is the only way to login through the couch index?
I mean something like this: Login: [......] Password: [......] somewhere in the head of a page.

You can try this (use your own markup but the name of the form fields cannot be changed)
Code: Select all
<cms:if k_logged_out >   
   <form name="frm_login" action="<cms:show k_login_link />" method="post">
      <p>
         <label>Username</label><br>
         <input type="text"  id="k_user_name" name="k_user_name" size="20"/>
      </p>
     
      <p>
      <label>Password</label><br>
      <input type="password" id="k_user_pwd" name="k_user_pwd" size="20"/>
      </p>
     
      <input type="submit" name="k_login" value="Login"/>
   </form>
<cms:else />
   <p>
      Logout <a href="<cms:show k_logout_link />"><cms:show k_user_title /></a>
   </p>   
</cms:if>

The snippet above calls in the actual 'login.php' that does the authentication stuff and then redirects back to the page this form was was invoked from.

A "side-effect" of this piggybacking is that if the username or password do not match (i.e. upon authentication failure), the default Couch's login page gets shown. Otherwise, the login should be seamless.

Hope this helps.
Can I have more than one comments "database"?(In the admin panel there is "users" and "comments") E.g. I have two or more different comment-forms, depending on the needs/situation. Is it possible to have an "approval page" for each different form? Or rename the existing "comments" in something different?
I will misuse the comments option to register for seminars and it would be really nice if they could be kept seperatly

Short answer: nope.
Long answer: This will have to wait till we implement the posting of pages from the site's frontend (instead of only from the admin panel). Once this becomes possible, you can use ordinary cloned pages as 'comments' or whatever you wish to 'misuse' them for and the users can post (actually create new pages entries) from the site itself.
This sound really promising! Btw., will users be able to change their own passwords in the future? Or have I overlooked this somehow?


KK wrote: Replying to your question regarding creating a custom login form on any page
[...]
Hope this helps.

It does. Thank you very much!
Btw., will users be able to change their own passwords in the future? Or have I overlooked this somehow?

In the future, yes certainly. You can expect full-fledged user management capability complete with fine grained access control in the future.
KK wrote: [...]
You certainly do not need to delete/recreate a template everytime you change/delete an editable region.
Once you delete an editable region, for the change to be picked up by Couch simply visit the template in the "page-view" (i.e visit one of the cloned page).
Please try it out.

I created a region type=text to enter a link to embed a youtube video and named it just 'youtube'. Later I added a region for vimeo and named it video_vimeo and renamed the other in video_youtube. The admin panel now shows three text regions: youtube, video_youtube and video_vimeo, instead of just the two.
Even when I delete one it still shows. Had this problem a couple of times.
Renaming an editable region is effectively deleting the original one and creating a new editable region.
So, in the case you described the region named 'youtube' should be marked as deleted.

Are you sure you have visited the template in the page-view (i.e. visited one of the cloned page)? An easy way of doing this is to click the 'magnifying glass' icon found on each cloned page's entry in the admin-panel.

At the risk of sounding repetitive, you need to visit the template in page-view for the deletion to be picked up by Couch.

Please try it out and confirm.

Thanks
Arg! Damn'it!... I'm sorry :). Always thought you meant I should reload one of the cloned pages in the admin panel. Since my setup prevents me from actually seeing something displayed in page-view I never thought of loading it. My apologies again! Works fine!
43 posts Page 3 of 5
cron