1 webadmin Nov 16, 2009 02:59
3 webadmin 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 yabba 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 webadmin 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 yabba 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>
¥
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?