Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hello.

I have one blog.php template which is clonable. I wanted to display these blog.php on 2 different ways.

First one,
I just wanted to display it with header and footer on front-end.

Second one,
I just wanted to display it without header and footer on front-end.

Any suggestions will be greatly appreciated.
Thank you!
Hi,

If you want to choose from the admin-panel as to which of the two layouts is to be used, one way would be to define a dropdown (or radio-buttons) offering the admin the choice.

On the frontend, first check what has been chosen and accordingly display the template's variables using <cms:if>, <cms:else /> blocks - this way only one kind of layout will be shown at a time.

The context of your question is not clear to me so if my answer is off mark, please elaborate with details on how (and where) you'd like to use the two views.

Hope this helps.
Hi KK,

My goal is I need blog.php in 2 different views. When admin post a news using News template from back-end that news must be published in 2 different types. First one must be with header and footer, second one must be without header and footer.

I can't figure it out very well, maybe second one without header and footer can be published in blog1.php? If it yes, I will fetch blog news as blog.php?p=1 and blog1.php?p=1 in different styles.

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='News' clonable='1' order='2'>
    <cms:editable name='blog_content' type='richtext' />
    <cms:editable name='blog_image' type='image' />
    <cms:folder name='news' title='Latest' />
    <cms:folder name='featured' title='Featured' />
</cms:template>
<cms:if k_is_page>
    <html>
    <head>
        <!-- some html !-->
    </head>

    <body class="hee"> 
        <div class="container">       
            <div class="row">
                <div class="col-sm-12 col-md-8">                   
                    <div class="col-sm-12 col-md-12"><img src="<cms:show blog_image />" width="100%" height="auto"></div>
                    <div class="col-sm-12 col-md-12 text-just">
                        <cms:show blog_content />
                    </div>
                </div>         
            </div>       
        </div>

        <footer><!-- some html.  !-->
        </footer>
    </body>
    </html>
    <cms:else />
    <cms:embed 'blog_list.php' />
</cms:if>
<?php COUCH::invoke(); ?>
3 posts Page 1 of 1