Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
Hi there,

on my wbsite I have an News section.
Link: http://www.boule-termine.de/news.php
At this time the whole dl-list (view html-code) is placed in one editable region
Code: Select all
<div id="news_blog">
    <cms:editable name='news' type='richtext'>
    </cms:editable>
</div>


Every block (dt and dd-element) can be clicked and some more Infos are shown.
I'd like to use couch on this, so that every news-block is a sepearate entry in the admin panel.
As you can see, the content of the news is not always the same size/content. There are links within, etc.
How could I do this with couch?

I read the docu, within repeatable regions I can't use richtext, which I'm using at this time.
In an niceedit field I can't put html-code - right? I tried and it is displayed as text.

Any ideas?

Another question to this point:
As a next step I'd like to put new news entries with a script into database automatically. How could this be done - or - in which tables I have to writes the entries.

My local try for a repeatable region:
Code: Select all
<div id="news_blog">
   <cms:repeatable name='multiple_news' >
      <cms:editable name='news' type='nicedit'>
      </cms:editable>
   </cms:repeatable>
   <dl>
      <cms:show_repeatable 'multiple_news' >
         <cms:show news />
      </cms:show_repeatable>
   </dl>
</div>


Any ideas are welcome.
Thanks.
with kind regards
Stefan
Hi Stefan,

It seems to be a perfect case for using regular cloned pages.

Simply declare your news template as being clonable and define a single richtext editable region within it (place the following code below the <?php require_once( 'couch/cms.php' ); ?> statement in your template) -
Code: Select all
<cms:template title='News' clonable='1'>
   
    <cms:editable name='news' type='richtext'>
   
</cms:template>

Now you can create each news item as a cloned page.
This will also give you a way to enter a date (publish-date from advanced menu) and title for the news.
Not to say, this is infinitely more scalable than repeatable regions (you can potential have any number of new items). You can use pagination if the news item are going to be numerous.

The code for displaying the news items now becomes -
Code: Select all
<div id="news_blog">
    <dl>
    <cms:pages masterpage='news.php'>
        <dt>
            <a class="button_acc open_acc" href="#">#</a>
            <span class="cmaroon"><cms:date k_page_date format='d.m.y' /></span> - <cms:show k_page_title />
        </dt>
        <dd style="display: block;">
            <cms:show news />
        </dd>
    </cms:pages>   
    </dl>
</div>

Notice we are making use of the page's date and title in the listing.

Hope this helps.
Hello KK,

thanks for your advice.
I think it would help more if I post my whole couch structure of news.php.
The way I tried to set up your advice seems not to work.

My actual structure of news.php:
Code: Select all
<?php
   require_once( 'couch/cms.php' );
...
?>

<!DOCTYPE html>
<cms:template title='News'/>
<html>
<head>
...
</head>

<body>
...
   <cms:editable name='back_text' type='richtext'>
   <div id="backs">
      <p class="backtext"></p>
   </div>
   </cms:editable>


   <div id="inhalt">

      <cms:editable name='news_title' label='News-Header' maxlength='90' type='text'>
      </cms:editable>

      <cms:editable name='news_text' type='richtext'>
      </cms:editable>


      <div id="news_blog">
         <cms:editable name='news' type='richtext'>
         </cms:editable>
      </div>

...

   <?php include('include/fuss.php'); ?>
   </div>

</body>
</html>
<?php COUCH::invoke(); ?>


How could your advice be set up in this environment?

Thanks in advance.
with kind regards
Stefan
Hi Stefan,

The first thing we need to do is declare the template as 'clonable'
<?php
require_once( 'couch/cms.php' );
...
?>

<!DOCTYPE html>
<cms:template title='News' clonable='1' >


</cms:template>
<html>
<head>
...
</head>

<body>
...

Next, declare the editable regions that are required to hold unique contents for each news item (we'll not need fields for title and date as they are already available as system fields) -
<?php
require_once( 'couch/cms.php' );
...
?>

<!DOCTYPE html>
<cms:template title='News' clonable='1' >
<cms:editable name='news' type='richtext' />

</cms:template>
<html>
<head>
...
</head>

<body>
...

Refresh the template by visiting as super-admin.
Now create a new cloned page for each news item in the admin panel.

Finally to display the news, use the following -
Code: Select all
<div id="news_blog">
    <dl>
    <cms:pages masterpage='news.php'>
        <dt>
            <a class="button_acc open_acc" href="#">#</a>
            <span class="cmaroon"><cms:date k_page_date format='d.m.y' /></span> - <cms:show k_page_title />
        </dt>
        <dd style="display: block;">
            <cms:show news />
        </dd>
    </cms:pages>   
    </dl>
</div>

Notice how we are using
<cms:show k_page_title />
<cms:date k_page_date format='d.m.y' />
<cms:show news />
within the cms:pages loop.

Hope this helps.
Sorry for answering late.

I made the changes to the pages, it's working, many thaks to that.

How is it possible, that I put one extra editable area on the news page which is not on every page, only once?

Second question, how can I make entries directly to database für creating a new nes page now?
In which tables do I have to create an entry for a new entry to shown?
with kind regards
Stefan
Hi Stefan,

How is it possible, that I put one extra editable area on the news page which is not on every page, only once?
I think you need a 'global' editable region. Please take a look at the following page of our tutorial (please find the 'Global values' section) for full explanation -
http://www.couchcms.com/docs/tutorials/ ... -ends.html

Second question, how can I make entries directly to database für creating a new nes page now?
In which tables do I have to create an entry for a new entry to shown?
You don't need to deal directly with tables etc. in Couch. Since the 'news.php' template has been declared as 'clonable' (if not, please make it so as shown in my previous post of this thread), you'll see a 'Add new' button in the admin-panel when you click on news section in sidebar.
This can be used to create new entries.

Hope this helps.
Hello KK,

thanks for your answer, I will look into the global-section.

KK wrote: Hi Stefan,

You don't need to deal directly with tables etc. in Couch. Since the 'news.php' template has been declared as 'clonable' (if not, please make it so as shown in my previous post of this thread), you'll see a 'Add new' button in the admin-panel when you click on news section in sidebar.
This can be used to create new entries.

Hope this helps.

Yeah, I know the admin panel and the add new button ;-)
I'm using a script to read new dates and put them into my DB. I'm a lazy programmer.
I like to put automatically a new news entry on the page after reading new dates via script.
It would be much easier for me to publish a news entry automatically.
with kind regards
Stefan
Yeah, I know the admin panel and the add new button ;-)
My apologies :oops:

As for the laziness - that is a virtue as far as programmers are concerned :)
Version 1.4 would make it possible to do what you mentioned.
8 posts Page 1 of 1