Recent Topics

1 Feb 09, 2006 04:57    

I've been searching through the forum on how to make stub files, but everyone seems to know what they're doing when asking questions. So how do I create a stub file? Does anyone have a step-by-step tutorial? :(

2 Feb 09, 2006 05:52

I got this funny feeling there is a step-by-step somewhere, but I'll go over it again just in case it's missing.

Look at the folder you installed b2evolution in. There you will find a file called "a_stub.php". Open it up in an editor and save it with whatever you want your stub to be called. For example save it as "mystub.php.

Now tell your installation you want to create a new blog - blog #5, or use the blogs tab to edit blog #3. Tell it that you are using a stub file and that it is named "mystub.php". Again edit your file - the "mystub.php" that you just created, and change the line that identifies the blog number. It looks like this:

$blog = 2;   	// 2 is for "demo blog A" or your upgraded blog (depends on your install)


Edit that line to be either 5 or 3, or whatever blog number is going to be "mystub.php". Upload that file to the same folder you have your b2evolution installation in (which could be the root 'folder').

Ta Da! You just created a stub file. There is a heck of a lot you can do in a stub. Just peruse the a_stub.php file and you'll see many different parameters you can set inside the stub, though I personally use them just to have the url look the way I want them to look.

3 Feb 09, 2006 06:37

Thanks, but I need some fine-tuning.

I've created the stub file, and named it about.php. I re-uploaded it to the same dir where a_stub.php was found. about.php is linked to blog 6. I made a test entry, however when I go to http://miso.zeeblo.com/b2/about.php , I get a blank page. When I go to the default blog at http://miso.zeeblo.com/b2/index.php, that test entry shows up :-/ . What did I do wrong?

4 Feb 09, 2006 20:16

When you copy the a_stub.php file don't erase all its contents. You need to have all the a_stup.php file stuff in your about.php file. Then you need to look through those lines of code for the part EdB told you about. You'll want to set your blog # to 6, it seems. And you might also want to tell what skin you want to use (there's a line in the code for that as well).

Hope this helps!

5 Feb 10, 2006 06:26

I've done the above already. Would it be because I'm editing it in Notepad? When I press Ctrl+S after editing php files, the lines tend to all join together instead of being line to line (if you get what I mean). Like once I save, the code is all bunched up. Here is a copy of my edited a_stub.php (oh yea, I haven't deleted the original copy of a_stub.php from the dir, would that affect anything?)

<?php/** * This file is a stub file for displaying a blog, using evoSkins. * * This file will set some display parameters and then let b2evolution handle * the display by calling an evoSkin. (skins are in the /skins folder.) * * Note: You only need to use this stub file for advanced use of b2evolution. * Most of the time, calling your blog through index.php will be enough. * * Same display without using skins: a_noskin.php * * b2evolution - {@link http://b2evolution.net/} * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html} * @copyright (c)2003-2004 by Francois PLANQUE - {@link http://fplanque.net/} * * @package evoskins * @subpackage noskin */# First, select which blog you want to display here!# You can find these numbers in the back-office under the Blogs section.# You can also create new blogs over there. If you do, you may duplicate this file for the new blog.$blog = 6;   	// 2 is for "demo blog A" or your upgraded blog (depends on your install)# You could *force* a specific skin here with this setting: (otherwise, default will be used)# $skin = 'custom';# This setting retricts posts to those published, thus hiding drafts.# You should not have to change this.$show_statuses = array();# You could *force* a specific link blog here with this setting: (otherwise, default will be used)# $linkblog = 4;# This is the list of categories to restrict the linkblog to (cats will be displayed recursively)# Example: $linkblog_cat = '4,6,7';$linkblog_cat = '32';# This is the array if categories to restrict the linkblog to (non recursive)# Example: $linkblog_catsel = array( 4, 6, 7 );$linkblog_catsel = array( );# Here you can set a limit before which posts will be ignored# You can use a unix timestamp value or 'now' which will hide all posts in the past$timestamp_min = '';# Here you can set a limit after which posts will be ignored# You can use a unix timestamp value or 'now' which will hide all posts in the future$timestamp_max = 'now';# Additionnaly, you can set other values (see URL params in the manual)...# $order = 'ASC'; // This for example would display the blog in chronological order.../** * That's it, now let b2evolution do the rest! :) */require(dirname(__FILE__)."/b2evocore/_blog_main.php");?>

Edit: Well, I guess you can see what I mean when I say the code is all bunched up from the above ^^^^^^^^^^^

6 Feb 10, 2006 08:01

AFAIK notepad shouldn't do that, but obviously is. You certainly don't want that happening to your files! There are many free editors out there, so use what works for you, but I like HTML-Kit (google it). Once you have a nice editor try it all again with an eye on not having your files bunched up into a meaningless blob. Meaningless blobs are b-a-d!

7 Feb 10, 2006 09:04

Thankyou so much! It works like a charm now :D~

8 Feb 11, 2006 01:49

This is a stupid question, but is it possible to put the sidebar elements into a stub file? Or any other page format such as html?

9 Feb 11, 2006 02:24

raspb3rry, I think you're misunderstanding what a stub file is. It's not a snippet that gets included on another page...the stub file is the entire page. So of course you can make your stub file as minimalist as possible, but then you can't do much with it.

11 Feb 25, 2006 04:01

That's exactly how they work. Create the "uniqueblog1.php" file, but when you look it up you will use www.website.com/blogs/uniqueblog1 to access the page. I'm not sure how or why it works, but that is the way it functions. You don't need to put index.php there.

12 Feb 27, 2006 13:43

Sorry for reviving this thread again, but that topic is bugging me since I've installed b2.

I've been through all the steps you described and when I finally want to access a blog via a URL like: http://path_to_b2/stub_file_name (without the php extension), I receive a 404 like

b2evolution cannot resolve the requested URL.

Any ideas how to resolve this?

13 Feb 27, 2006 14:46

I just posted this to another thread but I can copy it here as well:

I just looked at my backoffice setup and noticed that in the Blogs tab, where it asks for the name of the stub file, if I type "stub" then my url will be www.website.com/stub, but if I write "stub.php" my url will be www.website.com/stub.php.

You might want to double check there and remove the .php extension if you have it. It's not necessary.

Hope that helps.

14 Feb 27, 2006 15:05

Gotcha!!! Might be something that could be expressed more precisely in the description of that setting. :)

Anyway, thanks a lot!

15 Mar 02, 2006 11:47

Thx a lot for this short explanation - saved me lot of times (and nerves, I guess *g*).

Cheers,
Joshua

16 Jun 03, 2006 09:58

Nate wrote:

That's exactly how they work. Create the "uniqueblog1.php" file, but when you look it up you will use www.website.com/blogs/uniqueblog1 to access the page. I'm not sure how or why it works, but that is the way it functions. You don't need to put index.php there.

Neither works for me at all - I have done EXACTLY as told: copy the a stub file, rename the file [no other changes made to it], uploaded the file in the same location as the a stub file is, went to admin, created a new blog, named the stub in there - I get absolutely NOTHING:
the url without the php = produces: 404 error
with the php it gives me Requested Blog does not exist.

By now I am soooooo frustrated, because not even the default installed blogs work, except the link page blog.
I am ready to give up after trying for one full day to get some REAL help - to no avail.
Short of all over again installing this thing - I might as well install a less complicated blog.
Sorry to say this, your blogs look nice, but the documentation is far behind, and it is rather more complicated with code, than anything else.

17 Jun 03, 2006 10:39

activebiz wrote:

... I have done EXACTLY as told: copy the a stub file, rename the file [no other changes made to it] ...

But you HAVE to edit the newly named file!!! You have to tell it which blog number the stub is associated with. You can have a hundred blogs, and each one will have a number. So if you use stubs each stub file has to say in it which blog NUMBER the stub is for.

Check it out: I use stubs. Always have, probably always will. EACH of my blogs is run by a stub EXCEPT my "primary blog on index.php" which is set up to be my primary blog. The way index.php (as shipped with b2evolution) is written is to sort of 'be' the stub. Not exactly, but close enough to get the job done. When I decided to put my hang glider rack photos in their own blog I decided it would be called "rackblog", so I created rackblog.php. Since rackblog was going to be blog #7 I copied another stub file as rackblog.php and edited the $blog parameter to be 7. Done!!! It automagically got added to my blog list links and my back office. I created categories (and a handful of extremely groovy hacks by the way) and my shiny new blog was up and running. One day I might revive my online flight log. If so I'll create a new blog for it (since I use flightblog for stuff about flying), and I'll create a new stub file, and I'll edit that file to tell it that it is all about blog #8. Maybe it'll be "logblog" or better still "flogblog". Yeah. "flogblog" sounds good. So I'll need a stub named flogblog.php and I'll have to edit that new file because each stub needs to say exactly which blog number it is for.

Aw crap. Now I'm going to make flogblog just because it's a cool name. See what you did!!! Do you have any idea how many hacks I'll have to undo and redo in order to get all my flight data actually into a useful format again? But I want to have a flogblog so it's worth it. To me anyway ;)

-----------

Hey and provide a link to the blog you're working on. We can do so much more if we see a link because we know how to craft urls to find what's up and down and can sort of outsmart whatever booboos you might have going on.

EDIT: I see that you did in the other thread on the same topic. http://www.marsart.org/blogs/artstub.php finds what you're after.


Form is loading...