Recent Topics

1 Jul 14, 2004 17:34    

I have created a few different blogs with b2 and want to call each one up on a different page within my website's header and footer. Each page shares the same header and footer, but contains a different .txt file and blog in the body.

For some reason, my standard practices are not working. The .txt file comes up fine within the header and footer, but the blog doesn't.
---------------------------------------------------------------
Here is my code for a sample page:
<?php include("header.php"); ?>

<?php include("content/about.txt"); ?>

<?php include("blogs/index.php?blog=2"); ?>

<?php include("footer.php"); ?>
---------------------------------------------------------------
I receive this error:
Warning: main(blogs/index.php?blog=2): failed to open stream: No such file or directory in /home/anan/public_html/cadf/about.php on line 5

Warning: main(): Failed opening 'blogs/index.php?blog=2' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/anan/public_html/cadf/about.php on line 5
---------------------------------------------------------------
Please enlighten me to what I need to do to get this to work. Thanks!

2 Jul 14, 2004 19:31

take a look on a_noskin.php on how to include a blog in a "normal" website.

3 Jul 14, 2004 19:35

What is in the text file? Why not use one skin, and use the long description for each blog, for example? It seems a lot less complicated...

4 Jul 15, 2004 00:05

Here's the problem.

<?php include("blogs/index.php?blog=2"); ?>

That's not correct. You only use ?param=val when you're sending vars in through the GET request, and then they show up as $_GET['param'] = 'val';

<?php include("blogs/index.php?blog=2"); ?>
shoudl be
<?php
$blog=2;
include(dirname(__FILE__) . '/blogs/index.php');
?>

Note that I also added dirname(__FILE__) which means "the directory that this file is in."

5 Jul 15, 2004 01:26

So far, the a_noskin.php has been working well for displaying the blog posting, but all the rest of the "linked" pages (add/view comment, trackback, etc.) lead me out to the default skin.

How do I fit those into the same website template as the blog posts?

6 Jul 16, 2004 14:18

That's what stub files are for!

Just use a stub file as your base "top level includer" and add includes for your header and your footer into the stubfile. Of course you'll also need a skin that works with your header and footer. (Or you can include header and footer directly into the skin),

But anyway, trying to include "index.php" is the least efficient way to do the job.


Form is loading...