Recent Topics

1 Nov 16, 2009 02:59    

My b2evolution Version: 3.3.2

I just upgraded to 3.3.2 from 2.4.6. I use a lot of stub files on a site because it existed way before b2evolution.

Stub files used to work fine, including in a mixed way:
<?php
stub variables
?>
<html> for page
<?php require $inc_path.'_blog_main.inc.php';?>
<more html>

Here's what works:
stub file loads, loads prelim HTML, shows blog posts, then refuses to show more HTML, giving the famous "Warning: Cannot modify header information - headers already sent by (output started at ..."

It is complaining somewhere mid way through the initial <html> for the page -- style sheets, etc. Change the code, still complains. If I get rid of all HTML, sure it works fine, but I really want those header customizations and it used to work fine before the upgrade.

Blog works fine on pages that are not stub files. Yes, maybe someday could get rid of stub files, but for now need those category pages more customized than current catdir coding allows. And used to work fine before upgrade.

I've been working on this for about 8 hours. Any ideas welcome. Thanks!

2 Nov 16, 2009 15:01

So this is gonna sound funny, but why not put your html bits in the appropriate file in your /skins/yourskin/ folder? Like, the skin ends up producing everything between <html and /html>, so why not put your bits in there?

3 Nov 16, 2009 17:58

I heavily use b2evolution as a CMS on this site, so it's being used on pages where it's generating categories, which i want to customize with different images, keywords, extra navigation, etc. Many pages b2evolution generates directly, and they work fine, but I have many pages that were stub files that used to work fine, but now only the top navigation loads after the upgrade. The code is like this and it complains about the style lines in the header, and loads the page but stops before the bottom nav after b2evolution loads the cookie.

<?php
ini_set('display_errors', 1);
$blog = 5;
$cat = 25;
$skin = 'plain';
$show_statuses = array('published');
$timestamp_min = '';
$timestamp_max = 'now';?>
<?php require_once dirname(__FILE__).'/../news/conf/_config.php';?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<meta name="keywords" content="">

<title>title</title>

<style type="text/css"> 
@import url(/styles/styles.css); 
</style>
</head>
<body>

<?php include("templates/header-shortpage.html"); ?>
<?php include("templates/arts_header.html"); ?>

<h1>Title</h1>


<?php 
require $inc_path.'_blog_main.inc.php';
?>
include("templates/footer.html"); ?>
</body>
</html>

4 Nov 16, 2009 19:21

your stub :

<?php
ob_start();
// set stub variables
require_once $inc_path.'_blog_main.inc.php';
?>
<!-- your <head></head> -->

<?php
echo preg_replace( '~^.+?</head>(.+?)</body>~is', '$1', ob_get_clean() );
?>

<!-- your footer -->

</body>
</html>

ish

¥

5 Nov 21, 2009 05:48

I appreciate the reply, but when I use this example, it just shows the blog posts -- no header or footer and also no errors. I'm not quite sure what the regex is doing? Thanks again.

6 Nov 21, 2009 16:19

Sorry, that was free typed, the regex is to remove the standard evo header/footer to allow you to use your own, but it was flawed logic anyway ;)

<?php
ini_set('display_errors', 1);
$blog = 5;
$cat = 25;
$skin = 'plain';
$show_statuses = array('published');
$timestamp_min = '';
$timestamp_max = 'now';?>
<?php
require_once dirname(__FILE__).'/../news/conf/_config.php';
ob_start();
require $inc_path.'_blog_main.inc.php';
$blog_content = preg_replace( '~^.+?<body>(.+?)</body>~is', '$1', ob_get_clean() ); 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
      <meta name="keywords" content="">

<title>title</title>

<style type="text/css">
@import url(/styles/styles.css);
</style>
</head>
<body>

<?php include("templates/header-shortpage.html"); ?>
<?php include("templates/arts_header.html"); ?>

<h1>Title</h1>


<?php
echo $blog_content;
?>
include("templates/footer.html"); ?>
</body>
</html>

¥


Form is loading...