1 maflu Jul 22, 2004 21:15
3 isaac Jul 23, 2004 01:31
Check out http://forums.b2evolution.net/viewtopic.php?t=1913 and my post over there. Does that answer your question?
4 maflu Jul 23, 2004 16:36
isaac wrote:
Check out http://forums.b2evolution.net/viewtopic.php?t=1913 and my post over there. Does that answer your question?
Not really. Is there a way to insert includes in a particular place in my homepage and use b2evolution there?
My page is not simply a header and a footer. There is content as well.
Cheers
5 isaac Jul 23, 2004 17:11
isaac wrote:
Option 2: Use a plain template
In the default installation of b2evolution, there are a few files called "noskin_a.php", "noskin_b.php", etc. I believe that they're based on the "fplanque2002" skin, but you can either look at them to see how it's done, or edit them incrementally to create what you want. Basically, a template only has a few main features.First, tell b2evo not to use a skin:
$skin = '';
Next, get the b2evo ball rolling:require(dirname(__FILE__).'/b2evocore/_blog_main.php');
There's also some other initializations and setup you can do in the beginning of the template. Check out "a_noskin.php" or "noskin_a.php" and read the comments for more direction.Why would you do this instead of using a skin?
If you already have a fully crafted webpage, and just want to include a few b2evo features into it, and you don't want to use b2evo as the main CMS that drives your site, then a plain template is probably the best way to go. Copy the top PHP section out of one of the noskin files into your page. Then, use the [url=http://b2evolution.net/man/2004/06/04/template_functions]template functions[/url] to do stuff.
In other words,
At the top of your php file, you put all the stuff that's at the top of the "noskin" file (inside the <?php and the ?>. Sets up b2evolution.)
Then, you have all your HTML.
Once you have that top section at the top of the page, you can use the [url=http://b2evolution.net/man/2004/06/04/template_functions]template functions[/url] anywhere in your page.
Look at the noskin template files for guidance.
Then, in the backoffice, you can set the blog access type to "other blog through stub file," and set the stub filename to the template name.
6 maflu Jul 23, 2004 17:36
OK thank you for your help. I am not sure I understand the last part of your comment (about the back office and the stub file) but I am going to study your documentation in detail and see if I can get by. If not, I will come back to you.
Cheers
7 mattbta Jul 23, 2004 18:00
I've got it integrated into my home page via the stub file. It's pretty straight forward if you set up your stub correctly. I went a little further by changing some of the link generation and other things.
http://www.brotherson.com <-- home page
http://www.brotherson.com/b2 <-- b2evo install dir/full blown page
I keep toying with the idea of saying screw it and moving all the b2evo files into the root and just making a skin to look like my home page, but I'm not sure yet.
Back on topic...
--------------------
I call my stub file with an include and had to change the require statement at the require statement at the end to get it to read the correct file in b2installdir/b2evocore/_blog_main.php .
It's pretty simple, and b2evo's functions are set up so nice that once you include that main file, you can call any funtion you want and have it show up where you place it. Way cool.
Let us know if you get stuck.
8 maflu Jul 24, 2004 08:56
At the top of your php file, you put all the stuff that's at the top of the "noskin" file (inside the <?php and the ?>. Sets up b2evolution.)
Then, you have all your HTML.
I tried that but I get the following message at this stage:
"Fatal error: Failed opening required 'c:\program files\easyphp\www\myweblog/b2evocore/_blog_main.php' (include_path='.;C:\Program Files\EasyPHP\php\pear\') in c:\program files\easyphp\www\myweblog\tmp10o781cgh8.php on line 58"
What do you think?
9 mattbta Jul 24, 2004 15:46
I see you're running windows or your host is. I had to change a the require statement on mine to
require("b2/b2evocore/_blog_main.php");
If your file calling the blog is in www then I would put this in for the require statement:
require("myweblog/b2evocore/_blog_main.php");
10 isaac Jul 26, 2004 08:40
you're not pointing at the file properly.
Consider this setup. Two files: .../foo/bar.php and .../blah/bloo.php. Both can be placed in whatever folder, as long as the foo and blah folders are in the same place.
Keep in mind that ".." means "go up one level." So, "c:\folder\..\" is the same as "c:\".
// c:\path\to\blah\bloo.php
// includes foo/bar.php, and stops execution if it can't get it.
require( dirname(__FILE__) .'/../foo/bar.php');
// includes foo/bar.php, but generates a warning if it can't get it.
include( dirname(__FILE__) .'/../foo/bar.php');
// echoes c:\path\to\blah\bloo.php
echo __FILE__;
// echoes c:\path\to\blah
echo dirname(__FILE__);
// echoes c:\path\to\blah/../foo/bar.php
echo dirname(__FILE__) . '/../foo/bar.php';
// doesn't do anything, because it's already been done
require_once( dirname(__FILE__) . '/../foo/bar.php' );
It is important to always use the "dirname(__FILE__)" when including files using relative locations.
11 mattbta Jul 26, 2004 19:08
Isaac - I had played with getting the dirname_file call to work on my windows box forever, but didn't have it right. Following your example, I changed it to properly call the file. :thumbsup:
Yup, you could just change the template/skin to your current page and insert the code for the parts of the blog that you want to shown, into whatever part of the site you wish