Problems, need help? Have a tip or advice? Post it here.
9 posts Page 1 of 1
I've set up a simple "Specials" box on the homepage.

I have a masterpage specials.php (in website root)
and a specials-snippet.inc (in couch snippets folder)

Index.php has <cms:embed 'specials-snippet.inc' />

This shows the specials all the time.

What I would like to do is have the ability to not display that box.

I have tried unpublishing the specials.php, but it still shows up to the public.
How do I turn it On / Off ?
Hi Dan,

There is not enough data to understand the problem fully.
Can you please set us know -
If the specials.php template is clonable?
What are the contents of specials-snippet.inc?
How are you creating the box on index.php?

Thanks
Thank KK
Sorry, here's the rest.

index.php
standard couch page with Invokes etc.

Original live page http://www.vintessential.com.au/
Bottom right - "Winemaking with Grapes... " is the part that I need to turn on / off
That live version was first attempt, but when client chose unpublished, the whole index.php disappeared (as it should - I didn't think about it when I coded it)

contains line
Code: Select all
<cms:embed 'specials-snippet.inc' />


Specials-snippet.inc
Code: Select all
<article class="side-link special-home">
<h1><cms:get_custom_field 'special_heading' masterpage='specials.php' /></h1>
<p><cms:get_custom_field 'special_details' masterpage='specials.php' /></p>
</article>


specials.php
Code: Select all
<?php require_once('couch/cms.php'); ?>
<cms:template title='Specials Home' executable='0' />
<h1><cms:editable name='special_heading' type='text'></cms:editable></h1>
<p><cms:editable name='special_details' type='richtext'></cms:editable></p>
<?php COUCH::invoke(); ?>


@webecho
Thanks. I get it now.

Please try using the following code in your snippet
Code: Select all
<article class="side-link special-home">
<cms:pages masterpage='specials.php' limit='1'>
    <h1><cms:show 'special_heading' /></h1>
    <p><cms:show 'special_details' /></p>
</cms:pages>
</article>

cms:pages will respect the publish status of pages and will not fetch in the data for unpublished pages.

Hope this helps.
KK
You are an absolute champion!
I knew there would be a way to do it, but I've never spotted the "limit" before.
Thank you so much mate

@webecho
Damn - getting Error: masterpage: "specials.php" not found.
Should it be in site root?
If the masterpage is 'specials.php', then specials.php needs to be in the root.
If, for example, it were to be in a subfolder named 'test', the masterpage would become 'test/specials.php'.

Hover your mouse on the template's entry in admin-panel's sidebar - a tooltip will show the template's name as understood by the system.
thanks KK
Hover says it's in the right place ... will double check the code, must have missed something.


@webecho
Thanks again KK

All working perfectly now.

@webecho
9 posts Page 1 of 1