php displays blank in browser

5 posts by 3 authors in: Forums > CMS Builder
Last Post: June 18, 2009   (RSS)

By LaKinns - November 15, 2008 - edited: November 15, 2008

CMSB is fairly new to me but I am working through it.

I am in the testing stages with the codeing. I have dropped in the code from the code generator as instructed. The pages and the code look fine locally but when uploaded to my web space I loose all the coding and the pages come up blank


Here is the code I dropped in - HELP [:)]

<?php

require_once "/xxxxxxxxxxxxxxxxxxxxxxxxxxcmsAdmin/lib/viewer_functions.php";

list($about_usRecords, $about_usMetaData) = getRecords(array(
'tableName' => 'about_us',
));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
body { font-family: arial; }
.instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>
</head>
<body>

<!-- INSTRUCTIONS -->
<div class="instructions">
<b>Sample List Viewer - Instructions:</b>
<ol>
<?php ?>
<li><b>Remove any fields you don't want displayed.</b> (Most list pages only have title and link fields.)</li>
<li>Rearrange remaining fields to suit your needs.</li>
<li>Copy and paste code into previously designed page (or add design to this page).</li>
</ol>
</div>
<!-- /INSTRUCTIONS -->

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>About Us - List Page Viewer</h1>
<?php foreach ($about_usRecords as $record): ?>
Record Number: <?php echo $record['num'] ?><br/>
Title: <?php echo $record['title'] ?><br/>
Content: <?php echo $record['content'] ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>

<hr/>
<?php endforeach; ?>

<?php if (!$about_usRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->

</body>
</html>

Re: [LaKinns] php displays blank in browser

By Dave - November 17, 2008

Hi LaKinns, welcome to the CMS Builder forum! :)

There's a few things you can try. First, try viewing source. Sometimes a stray tag can cause the output to appear blank even if there's lots of content there.

Next, some web hosts are configured to not show any php errors. Try adding this code (in red) above step 1 to turn on error reporting:

<?php


// show all errors
if (!defined('E_STRICT')) { define('E_STRICT', 2048); } // define E_STRICT for PHP < 5
error_reporting(E_ALL | E_STRICT); // display all errors
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');


And if none of that works feel free to email me CMS and FTP login details to dave@interactivetools.com and I can take a look for you. (Note: email, don't post login details to the forum).

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [erinm356] php displays blank in browser

By Dave - June 17, 2009

Hi Erin,

Yes, just change this line in all your viewer files:
require_once "D:/A10 Websites/www.soldiersandsailorsmuseum.org/cmsAdmin/lib/viewer_functions.php";

And update the part in red to have the path to your new directory.

Also, if you want to make it more portable and you know where your viewers will be in relation to the cmsAdmin dir you can make it simpler:

If all your viewers are in the root of your website you can just use this:
require_once "cmsAdmin/lib/viewer_functions.php";

And if they are in subfolder of your root you can do this:
require_once "../cmsAdmin/lib/viewer_functions.php";

And then moving dirs in future won't break it.

Hope that helps, let me know if the makes sense and works for you! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] php displays blank in browser

By erinm356 - June 18, 2009

Thank you, Dave! That was exactly what I needed. It's working perfectly now.