Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
I need example for the best solution to make "news" on the homepage, and ofc must be edited and easy to make in Couch.

I will have for example 3 news and some short text. How to make?

something like that: https://wireframe.cc/GMwiKV (this is fast sketchup)

and when is clicked on some news i will have a large text of this news on other page. it's something like mini portal with news and announcements

Tnx for help :)
I did it with globals.php

Global settings
Kindly take a look http://www.couchcms.com/docs/tutorials/ ... -ends.html

globals.php
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Global Settings' executable='1'>
   <!-- Start News Section -->
   <cms:editable name='news_section' label='Edit News Section' desc='Edit, Add Remove News' type='group' />
   <cms:editable name='news_name ' label='Change Breaking News name' type='text' group='news_section'>Breaking News</cms:editable>
   <cms:editable name='news1' label='Your Site\'s news 1' type='text' group='news_section'></cms:editable>
   <cms:editable name='news2' label='Your Site\'s news 2' type='text' group='news_section'></cms:editable>
   <cms:editable name='news3' label='Your Site\'s news 3' type='text' group='news_section'></cms:editable>
   <cms:editable name='news4' label='Your Site\'s news 4' type='text' group='news_section'></cms:editable>
   <cms:editable name='news5' label='Your Site\'s news 5' type='text' group='news_section'></cms:editable>
   </cms:template>
<?php COUCH::invoke(); ?>
   <!-- End News Section -->

and after that in snippets/news.html I added
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

<div class="breaking-news">
<span><cms:get_custom_field 'news_name' masterpage='globals.php' /></span>
<ul>
<li><a href="" title=""><cms:get_custom_field 'news1' masterpage='globals.php' /></a></li>
<li><a href="" title=""><cms:get_custom_field 'news2' masterpage='globals.php' /></a></li>
<li><a href="" title=""><cms:get_custom_field 'news3' masterpage='globals.php' /></a></li>
<li><a href="" title=""><cms:get_custom_field 'news4' masterpage='globals.php' /></a></li>
<li><a href="" title=""><cms:get_custom_field 'news5' masterpage='globals.php' /></a></li>
</ul>
   
<script type="text/javascript">
         jQuery(document).ready(function(){
                        createTicker();
                     });
      </script>
</div> 

<?php COUCH::invoke(); ?>


and add this snippets to index.php (Homepage)
Code: Select all
<cms:embed 'news.html' />


And you can get idea look at http://www.couchcms.com/docs/tutorials/ ... folio.html
Subhamoy wrote: I did it with globals.php

Global settings
Kindly take a look http://www.couchcms.com/docs/tutorials/ ... -ends.html

globals.php
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Global Settings' executable='1'>
   <!-- Start News Section -->
   <cms:editable name='news_section' label='Edit News Section' desc='Edit, Add Remove News' type='group' />
   <cms:editable name='news_name ' label='Change Breaking News name' type='text' group='news_section'>Breaking News</cms:editable>
   <cms:editable name='news1' label='Your Site\'s news 1' type='text' group='news_section'></cms:editable>
   <cms:editable name='news2' label='Your Site\'s news 2' type='text' group='news_section'></cms:editable>
   <cms:editable name='news3' label='Your Site\'s news 3' type='text' group='news_section'></cms:editable>
   <cms:editable name='news4' label='Your Site\'s news 4' type='text' group='news_section'></cms:editable>
   <cms:editable name='news5' label='Your Site\'s news 5' type='text' group='news_section'></cms:editable>
   </cms:template>
<?php COUCH::invoke(); ?>
   <!-- End News Section -->

and after that in snippets/news.html I added
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

<div class="breaking-news">
<span><cms:get_custom_field 'news_name' masterpage='globals.php' /></span>
<ul>
<li><a href="" title=""><cms:get_custom_field 'news1' masterpage='globals.php' /></a></li>
<li><a href="" title=""><cms:get_custom_field 'news2' masterpage='globals.php' /></a></li>
<li><a href="" title=""><cms:get_custom_field 'news3' masterpage='globals.php' /></a></li>
<li><a href="" title=""><cms:get_custom_field 'news4' masterpage='globals.php' /></a></li>
<li><a href="" title=""><cms:get_custom_field 'news5' masterpage='globals.php' /></a></li>
</ul>
   
<script type="text/javascript">
         jQuery(document).ready(function(){
                        createTicker();
                     });
      </script>
</div> 

<?php COUCH::invoke(); ?>


and add this snippets to index.php (Homepage)
Code: Select all
<cms:embed 'news.html' />


And you can get idea look at http://www.couchcms.com/docs/tutorials/ ... folio.html


Code: Select all
<cms:embed 'news.html' />


this must be .html or .php?
.html or .php no matter.
Hey a new short process also here, above code for only add 5 nos, news, and now you can add unlimited news with this code.

in global.php
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>         
      <!--News Start -->            
               <cms:repeatable name='my_news' >
               <cms:editable
                  type='nicedit'
                  label='Description'
                  name='my_news' />
               </cms:repeatable>         
      <!--News End -->   
<?php COUCH::invoke(); ?>


and create a news.php in snippets with this code
Code: Select all
<cms:pages masterpage='news.php' >
                  <cms:show_repeatable 'my_news' >
                              
                           <p><cms:show my_news /></p>                     
                       
               </cms:show_repeatable>
                     </cms:pages>
5 posts Page 1 of 1