I am trying to integrate PayPal in my site but after I press the PayPal button this error appears:
Warning: Cannot modify header information - headers already sent by (output started at X:\home\test\www\view\main.php:29) in X:\home\test\www\view\frontend\paypalfunctions.php on line 377
The part of the main.php responsible for the error is this:
<div class="container">
<?php require 'view/frontend/'.$tpl.'.php';?>
</div>
This line of code is essential for my whole website to work. It conflicts with this particular function from PayPal's paypalfunctions.php:
function RedirectToPayPal ( $token )
{
global $PAYPAL_URL;
// Redirect to paypal.com here
$payPalURL = $PAYPAL_URL . $token;
header("Location: ".$payPalURL);
exit;
}
I carefully read this question about the issue and tried some things, but did not find a solution. Is there anything I need to change in the code for it to work?