Recent Topics

1 May 18, 2004 23:10    

Hello all,

I have another question, although this one is pretty basic. What is a stub file and how can I use it to my advantage? Perhaps if I knew the origins of the 'stub' it might be an eaiser concept to understand. I can't seem to find a straightforward answer to this in the wiki or in the forums.


PS I'm stubed on this one! (wagga wagga wagga) I'll be here all night ladies and gentleman, dont forget to tip your waitress) :roll:

2 May 18, 2004 23:14

The stub files are listed in under the "Blogs" tab in the administration area. Click on a blog and it will display the stub file. For example: blog_all.php and blog_a.php are stub files. If you want, you can rename these but make sure you reference it properly.

3 May 18, 2004 23:23

Ok I understand they exist and how to find them, but what function do they serve? Why would I want to rename them? If I copy a_stub.php to someothername.php will I have 2 copies of blog a, or just a new blog? Are the stub files the actual nuts and bolts of a blog? I think I'm still missing something.

Thanks for the timely reply!


4 May 18, 2004 23:34

In the stub file you can configure certain features of your blog for example the default skin of your blog. The stub file is also what you link to to access your blog.

If you want to create a new blog you have to do it in the admin. Copying will not work.

Most apperance configurations of your blog can be congifured in _main.php and *.*css in the appropriate skin folder. There are some other php files you can edit to configure other stuff. For example in the conf directory, you can configure language, date formatting, etc in the _locales.php file.

Hope this helps.

5 May 19, 2004 00:19

Okay, follow me on this:

Blogs are actually just textual data in a database.

But that's not how you want to look at it. You want to see a web page, right ?

For this, you will use a skins. Skins basically provide a layout to display the textual data that comes out of the database.

But that's not enough. How do you call a particular blog and have it displayed in a particular database?

The simplest way to call up a blog-display is to call index.php?blog=x where x is the ID of the blog you want to display. This will lookup the blog in the database, retrieve the default skin configured for that blog and do the display based on that.

There are variations on what parameters you can pass to index.php. For example you could call a blog by index.php/urlname and use the blog's URL name instead of its ID. You can also call index.php with no parameter at all, then the default blog will be displayed (with its default skin).

Now if you want more flexibility, what you do is create a stub file.

A stub file is a .php file onto which the webserver can hit, at any URL you may fancy. That stub file will in turn call b2evo to do the displaying job for a particular blog, and using a particular skin, based on the parameters you set *inside* of the stub file.

If you want your blog to be accessed at, then you just put a stub file called my_blog.php in the /this/is/a/fancy/path folder. (Note: on most apache installation, you will be able to omit the .php at the end of the URL, but you still have to name your file somethin.php).

You can create several stub files for the same blog if you want. They'll all work and display your blog in different locations of your site. However, when b2evo creates navigation links and especially permalinks, it will refer to the one and only stub file your have configured in the backoffice (unless you override this default behaviours in customized skins, but that's another subject).

Stub files let you set dozens of different parameters to fine tune how you want to display your blog. An example of a stub file is provided as a_stub.php (this is for version 0.9). If you duplicate a_stub.php 10 times, you'll have 10 different ways of calling blog_a with it's default skin. If you modify the 10 copies, you'll have 10 different displays. The first thing you'll want to do is display another blog than blog a. But you could also force the display to a specific skin, or use anothe rlinkblog, or decide to display posts in the future, or change the sorting order of your posts, etc...

Quick recap: index.php requires no file editing but will only display the blogs with their backoffice default config. stub files must be edited but let you display your blog in an extremely wide variety of ways and at any location you want in your website.

Does this help?

(I'm putting this on the wiki)

6 May 19, 2004 01:36

Ever have that moment in a class where suddenly everything makes sense? The formulas, the fundementals, how event a impacted event b, the "eureka" moment? Well I almost had one there with your explanation!! Great stuff. It was exaclty what I was looking for. My intial message was something like what you have written (a taking stock for knowledge if you will). But after writing it I scrapped it in favour of the what is a stub file question, so thank you for both taking stock of how things work, and then describing the stub file (its much better than my long winded crapfest).

So after reading your post, see if my logic is correct with my goal being a new blog at .../myblog.php

1. Create a new blog in the admin section, and give it a stub name of myblog.php. However, because the file myblog.php is not actually created but just referenced I have to;

2. copy the a_stub.php file to myblog.php and configure the parameter $blog to show the correct blog ID (the numbers showing on the right hand side of the blogs tab in the admin pannel).

At this point I have an exact copy of the style settings of blog a, with but showing the content (if any) of the new blog.

3. Now I can edit the css and _main.php to my hearts content to make things look funky.

4. Rinse and repeat for each blog I create, following the same process if need be for seperate linklogs for each blog/user..

I think I got it! Did I get it? Its how the big picture links to the little picture that was messing me up, but I feel good now. Again, thanks for the very helpful and swift responses. When I become an international blogging sensation I won't forget where I started....


7 May 19, 2004 10:45

all correct!

Thanks for asking the right questions! :D

Form is loading...

Community CMS – This forum is powered by b2evolution CMS, a complete engine for your website.