Preview problem

5 posts by 2 authors in: Forums > CMS Builder
Last Post: May 2, 2012   (RSS)

By joy - April 30, 2012

I think I need to add more code to my pages for the preview to function correctly, but I'll let you folks tell me.

When I make a change and I click the preview button, the page loads correctly, but I do not see the change I made.

The code I have included in my php page is:
<?php echo $contact_jcsRecord['content'] ?>

Am I missing something that needs to be in place for the preview button to show me changes before I save?

Thanks!!

Re: [Jason] Preview problem

By joy - May 1, 2012

I tried creating a special page (program-Details.php) and I also tried using the actual page (programs.php) and I while I can click preview and see the page, I couldn't get either option to correctly display a change before I saved it.

Below is the entire content for the actual page. Thanks for any help you can offer!

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/jcss3461/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($jcsprogramsRecords, $jcsprogramsMetaData) = getRecords(array(
'tableName' => 'jcsprograms',
'allowSearch' => '0',
'limit' => '1',
));
$jcsprogramsRecord = @$jcsprogramsRecords[0]; // get first record

// show error message if no matching record is found
if (!$jcsprogramsRecord) { dieWith404("Record not found!"); }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<META NAME="description" CONTENT="">
<META NAME="keywords" CONTENT="">
<META NAME="robots" CONTENT="INDEX,FOLLOW">

<script type="text/javascript" src="flashdetect.js"></script>


<!-- Noscript Support -->
<noscript><style type="text/css">.qmmc {width:200px !important;height:200px !important;overflow:scroll;}.qmmc div {position:relative !important;visibility:visible !important;}.qmmc a {float:none !important;white-space:normal !important;}</style></noscript>

<LINK REL="STYLESHEET" TYPE="text/css" HREF="/css/JCSstables_Equine_Facility_Style.css">

</HEAD>

<BODY BACKGROUND="JCSbackground.jpg" BORDER="0">

<!--** START MAIN MENU **-->
<TABLE WIDTH="881" CELLPADDING="0" CELLSPACING="0" BORDER="0" ALIGN="center">
<TR><TD>
<script type='text/javascript' src="/JCSmenu.js"></script>
</TD></TR>
</TABLE>
<!--** END MAIN MENU **-->


<TABLE WIDTH="881" CELLPADDING="0" CELLSPACING="0" BORDER="1" BORDERCOLOR="#554840" ALIGN="center" BGCOLOR="#FFFFFF">
<TR><TD>

<!--** START CMS CONTENT **-->

<TABLE WIDTH="880" CELLPADDING="0" CELLSPACING="0" ALIGN="center" BGCOLOR="#FFFFFF" BORDER="0">
<TR><TD VALIGN="top"><IMG SRC="logoJCSstablestrainingprograms.jpg"><BR><BR>
<?php echo $jcsprogramsRecord['content'] ?>
</TD></TR></TABLE>

</TD>
</TR></TABLE>

<!--** END CMS CONTENT **-->


</BODY>
</HTML>

Re: [joy] Preview problem

By Jason - May 2, 2012

Hi,

It looks like the problem is that you don't have a WHERE clause in your getRecords statement. If you don't need one on your regular page, I would suggest setting up a separate page that is just used for previewing, and set your getRecords () call like this:

// load records
list($jcsprogramsRecords, $jcsprogramsMetaData) = getRecords(array(
'tableName' => 'jcsprograms',
'allowSearch' => '0',
'limit' => '1',
'where' => whereRecordNumberInUrl(0),
));


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] Preview problem

By joy - May 2, 2012

Adding 'where' => whereRecordNumberInUrl(0), only works when I use a special preview page. But good enough for me. Thanks for your help!