Warning: Cannot modify header information

4 posts by 2 authors in: Forums > CMS Builder
Last Post: May 25, 2011   (RSS)

Re: [rez] Warning: Cannot modify header information

By Jason - May 24, 2011

Hi Rez,

You can re-arrange your code so that the header() function comes after your viewer_functions are included like this:

<?php
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/xxx/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."); }
list($home_slideshowRecords, $home_slideshowMetaData) = getRecords(array(
'tableName' => 'home_slideshow',
));
?>
<?php header('Content-type: text/html; charset=utf-8'); ?>
<<?php ?>?xml version="1.0" encoding="utf-8"?>
<SlideshowBox>
<items>
<?php foreach ($home_slideshowRecords as $record): ?>
<?php foreach ($record['slide'] as $upload): ?>
<item>
<thumbnailPath><?php echo $upload['thumbUrlPath'] ?></thumbnailPath>
<largeImagePath><img src="<?php echo $upload['urlPath'] ?>"/></largeImagePath>
<fullScreenImagePath><img src="<?php echo $upload['urlPath'] ?>"/></fullScreenImagePath>
<title>
<![CDATA[<?php echo $record['title'] ?>]]>
</title>
<description>
<![CDATA[<?php echo $record['dsc'] ?>]]>
</description>
</item>
<?php endforeach ?>
<?php endforeach ?>
</items>
</SlideshowBox>


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] Warning: Cannot modify header information

By rez - May 24, 2011 - edited: May 24, 2011

Unfortunately, that puts that error in that line, 10

"Warning: Cannot modify header information - headers already sent by (output started at /xxx/jsslide/sourcexml.php:1) in /xxx/jsslide/sourcexml.php on line 10"

If I remove that line, <?php header('Content-type: text/html; charset=utf-8'); ?>

it works. Probably not a good idea to remove it?

Re: [rez] Warning: Cannot modify header information

By Jason - May 25, 2011

Hi,

Try using the format shown here:

http://www.interactivetools.com/docs/cmsbuilder/rss_feeds.html


Give that a try and let me know if you run into any issues.

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/