Is it possible to set a record to pending?

7 posts by 2 authors in: Forums > CMS Builder
Last Post: January 11, 2012   (RSS)

By wbhood - January 10, 2012 - edited: January 10, 2012

I'm not even sure this is possible, but thought I'd ask.

I have a record placed at the top of my website that I'd like to use as our "emergency / inclement weather" notice box.

I have found that when I leave the record there and put no content in the WYSIWYG editor, it appears as if nothing is there.

However, what I'd like to do is place some basic content and then figure out a way to turn the record on only when I need for it to show up on the website.

My reason for this is so the other folks who may need to edit that temporary content can just go in there, edit it, turn it on, and it shows up.

If it were just me who needed to have access to this content, it wouldn't be a problem.

So, is there a way to have a record with content ready to go, but turned off and ready to be turned on? Then back off again when the emergency is over.

Thanks!

Re: [Jason] Is it possible to set a record to pending?

By wbhood - January 10, 2012 - edited: January 10, 2012

Ok, I created the hidden special field. When I click the checkbox to hide it, my entire page goes away and I have a message - Record not found!

My setup for this is as a Detail page for a single record.

What I want it to do is have the content associated with that record be hidden, but the rest of the page work as usual.

My goal is for this to be used for our inclement weather announcements and such.

Is there something else I need to do to make this work?

Re: [wbhood] Is it possible to set a record to pending?

By Jason - January 10, 2012

Hi,

Oh, I see what you're trying to do, you need to just hide a single field. Not a problem.

First, remove the "hidden" checkbox. Next, we'll create a new check box called "show_weather_announcement" (this will be the field name, you can give it any label you want).

We can then use this field in the code to decide if we should show the contents of the weather announcement or not.

Example (Note, In this example, I've assumed that the name of your wysiwyg field is weather_announcement, you may need to change this code to match what you have in your section)

<?php if ($record['show_weather_announcement']): ?>

<?php echo $record['weather_announcement'];?>

<?php endif ?>


So in this code, weather_announcement will be output whenever the checkbox was checked. If it is unchecked, the field won't appear.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Is it possible to set a record to pending?

By wbhood - January 10, 2012 - edited: January 10, 2012

Thanks Jason. I apologize for using the wrong terminology.

It looks like we're getting closer to what I want to do. I followed your steps and I am getting an error message at the top of the page:

Notice: Undefined variable: record in E:\inetpub\vhosts\mywebiste.com\httpdocs\index-test.php on line 225

My record name is emergency_header. I replaced the weather_announcement with emergency_header and put this in the location where I want the content to appear.

Then I got that error message above.

Here's the code from the generator:

Record Number: <?php echo $emergency_headerRecord['num'] ?><br/>
Title: <?php echo $emergency_headerRecord['title'] ?><br/>
Content: <?php echo $emergency_headerRecord['content'] ?><br/>
emergency_header: <?php echo $emergency_headerRecord['emergency_header'] ?><br/>
_link : <a href="<?php echo $emergency_headerRecord['_link'] ?>"><?php echo $emergency_headerRecord['_link'] ?>

Here's my new code from the generator:

Record Number: <?php echo $emergency_headerRecord['num'] ?><br/>
Title: <?php echo $emergency_headerRecord['title'] ?><br/>
Content: <?php echo $emergency_headerRecord['content'] ?><br/>
show_emergency_header: <?php echo $emergency_headerRecord['show_emergency_header'] ?><br/>
_link : <a href="<?php echo $emergency_headerRecord['_link'] ?>"><?php echo $emergency_headerRecord['_link'] ?>

Not sure that that helps or not. Again, I am doing this as a Detail Page not a List Page.

Any ideas what might be causing the error message?

Re: [wbhood] Is it possible to set a record to pending?

By wbhood - January 10, 2012 - edited: January 10, 2012

I think I figured it out. My code needed to look like this:

<?php if ($emergency_headerRecord['show_emergency_header']): ?> <?php echo $emergency_headerRecord['content']?> <?php endif ?>

not this:

<?php if ($record['show_emergency_header']): ?> <?php echo $record[emergency_header];?> <?php endif ?>

it seems.

It does seem to be working now. Thanks!

Re: [wbhood] Is it possible to set a record to pending?

By Jason - January 11, 2012

Hi,

Perfect! Glad to hear that's working for you now.

Let us know if you have any other questions.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/