Matt
Matt

Reputation: 1757

Wordpress PHP Include

EDIT SOLVED The code <?php ob_start(); ?> put before any other output seemed to solve the problem.

I have a problem with errors appearing on a page on my site.

I am including 3 php files before any HTML output which is.

<?php
include_once("rpw_includes/dtd_site_root.php");
include_once("rpw_includes/dtd_remote_module_classes.php");
include_once("rpw_includes/rpw_remote_module_classes.php");
?>
<!DOCTYPE html>
<head>

That code is in my header.php file and all works fine on my index file but when i go onto another page which also calls the same header file i get these errors.

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\barnet\wp-content\themes\barnet\search-results.php:7) in C:\xampp\htdocs\barnet\wp-content\themes\barnet\rpw_includes\dtd_remote_module_classes.php on line 15

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\barnet\wp-content\themes\barnet\search-results.php:7) in C:\xampp\htdocs\barnet\wp-content\themes\barnet\rpw_includes\dtd_remote_module_classes.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\barnet\wp-content\themes\barnet\search-results.php:7) in C:\xampp\htdocs\barnet\wp-content\themes\barnet\rpw_includes\dtd_remote_module_classes.php on line 17

Any ideas?

EDIT*

search-results.php

<?php 
/*
Template Name: Search Results
*/
?>
<?php ob_start(); ?>
<?php get_header(); ?>

<div id="page-search-hold">
<Div id="page-search"></div>
</div>

<?php 
$module_obj= new RPW_results_obj();
$module_obj->write_html(); 
?> 

<?php get_footer(); ?>

With the ob_start(); added the errors dissapear but i get about a 20px margin before my body starts like there should be erros but they are just not showing?

Upvotes: 1

Views: 676

Answers (1)

Victor Parmar
Victor Parmar

Reputation: 5789

Make sure that the other page that includes header.php has the include as the very first line.

Upvotes: 1

Related Questions