Recent Topics

1 Feb 25, 2006 06:39    

I've read numerous responses to questions about using stub files and subdirectories, but struggled to find a complete answer ... at least to my questions. I think I've found a solution, and I wanted to share with others what seems to have worked for me.

If those of you with SO much more experience with b2evolution see any errors or problems with what I've done, please feel free to comment. :-)

Here's what's working for me (using 0.9.1 "Dawn"):
1. Rename Blog 2 or Blog 3 (or create a new blog) as Example Blog

2. Save a_stub.php as exampleblog.php (in the same root directory as the a_stub.php file). Open exampleblog.php and edit line 24, "$blog = 2;" with the number of your blog (the number to the left of the name of the blog on the "Blogs" tab in the admin section) and save.

3. Create a subdirectory for Example Blog (i.e. if your root directory is www.website.com/blogs, then your subdirectory could be www.website.com/blogs/exampleblog).

4. Open your new stub file, exampleblog.php. Edit line 58, "require(dirname(__FILE__)."/b2evocore/_blog_main.php");" by adding a "/.." just before "/b2evocore/_blog_main.php". It should now read "require(dirname(__FILE__)."/../b2evocore/_blog_main.php");". Save this second version of exampleblog.php under the new subdirectory, "www.website.com/blogs/exampleblog". Save it again, just as it is, as index.php under the same new subdirectory, "www.website.com/blogs/exampleblog".

I found I needed all three stub files. The one in the root directory is what b2evolution primarily references, but you need the index.php stub file in the subdirectory in case someone were to type in the entire URL, "www.website.com/blogs/exampleblog/index.php." You don't need this stub file when people type in "www.website.com/blogs/exampleblog" or "www.website.com/blogs/exampleblog/". You need the second "exampleblog.php" file in the subdirectory because when you link to the Example Blog blog from any other blog in your directory, it will link to "www.website.com/blogs/exampleblog/exampleblog.php" because of how things have to be set up in "Access Parameters" (see below, but for now just trust me :-)).

5. Now, go in to the admin section of your blog site (i.e. www.website.com/blogs/admin). Click on "Blogs" and the click on 'Example Blog". Under "Access Parameters" (the second section under the "General" tab) select the radio button next to "Other blog through stub file (Advanced)." For "Blog Folder URL" enter (using my example) "/exampleblog" following the given web address. For "URL Blog Name/Stub Name" enter (again, using my example) "exampleblog.php".

Fill out any other information you want to here, but this is what you need to do to make the stub file work.

6. Click on the "Settings" tab in the admin section. Under the "General" tab, third section "Link Options," check box for "Use extra-path info" and select the radio button "Post called up by its URL title (Recommended)" under "Permalink".

I think I've included all I had to do to be able to use stub files and subdirectories for a "marketing-friendly URL" such as www.website.com/blogs/exampleblog.

2 Feb 25, 2006 15:57

Thanks for the information. Just for the record, most people probably won't need step 4, but I see how it works for you.

3 Feb 25, 2006 21:04

I'm curious what the purpose of using folders is. Like, what else besides the stub file goes in the folder? I'm assuming one installation of b2evolution in the root directory, so what would be the benefit to the blogger or visitor given that the posts are stored in the database?

4 Feb 27, 2006 04:30

For me, the reason for using folders is purely for marketing purposes. I work in marketing and PR and it "looks" better/cleaner to promote a URL like "www.website.com/blogs/exampleblog" than it does to promote an address like "www.website.com/blogs/exampleblog.php.

One of the main reasons I selected b2evolution was the option for multiple blogs and multiple authors, due to our organization's needs. We plan to have multiple blogs running and I want each blog to have it's own "address," i.e. blogs/exampleblog, blogs/admissions, blogs/financialaid. For the same reason that a college usually promotes their website as "www.college.edu/admissions" instead of "www. college.edu/admissions/index.php", I want to be able to promote our blogs with similar URL friendly addresses.

I hope this makes sense. I am REALLY new to blogging software and systems, though, so I'm sure there are still things I need to think through. Again, if anything I've written is in error, please feel free to correct me.

By the way, I've found both of your posts/replies to be very helpful in the forums. Thank you for taking the time to respond to so many people.

5 Feb 27, 2006 05:34

After re-reading I think you might be missing an easier way. To get the url www.website.com/blogs/exampleblog you do not need to create a subdirectory for exampleblog which contains the stub file. You just make an "exampleblog.php" file and put it in the /blogs directory. All the url magic is done automatically.

This way you only need one stub file, not 3. I don't know anyone who would type www.website.com/blogs/exampleblog/index.php, unless you give them that wrong address in the first place.

And as for b2e linking to www.website.com/blogs/exampleblog/exampleblog.php, that doesn't happen. On my site with stub files the links look just as you would hope: www.website.com/blogs/exampleblog.

Maybe I'm just getting confused, but I thought I'd pipe up again on the topic. :o

6 Feb 27, 2006 14:30

That doesn't seem to always be the truth though... On my server I get a 404 when typing the url www.mywebsite/blogs/stub if the name of the stubfile is stub.php, while the url www.mywebsite/blogs/stub.php works fine.

Don't know why, but it isn't important to me.

7 Feb 27, 2006 14:44

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.

8 Feb 27, 2006 15:08

That didn't work for me either, I removed the .php extension in the backoffice area, but the result was the same. Anyway, the thing isn't important to me, I just thought I should mention it so we're aware that the phenomena exists.

9 Mar 27, 2006 05:30

My experience, on an apache server is like leTH's, i.e. I need to use rnink's solution.

BUT I cannot figure out how to get the stub to use a particular skin when I use leTH's solution. Without stubs it works fine. (As it does without leTH's directories.) With stubs and directories, b2 ignores the skin info.

I have tried every permutation of the path to the skin that I can think of with line 27 of the stub file, but no luck.

10 Apr 08, 2006 21:02

I had the same issues and found the solution through .htaccess.

Add this to your .htaccess file and your url should work without the file extension:

Redirect permanent /stub http://www.yoursite.net/stub.php

The example assumes your stub file is in the main directory. The Bulletin Board script is also underlining the url which isn't correct. Be sure all the info is kept on one line in your .htaccess file. I'm not following the logic of seperate folders either as it just lengthens your url.

Hope that helps.

11 Apr 13, 2006 10:47

Hi,

I'm using version 1.6 Phoenix.
I've setting my b2evo to use stub files following this post.
All works fine.

But when visitors want to use the Trackback command, they got an error 403.

I don't have this problem if I don't use stub file.

any Idea ?

thanks in advance.

12 May 17, 2006 15:17

Hi

I've installed 0.9.1 on a WIN2K3 with PHP 4.2.2 and MySQL 5.0.19, and I would love to use this subdirectory feature.

I've installed the blog system, and have now pointed out some admins to administer the blogs.
The admins do not have access to the server, they are only admin of b2evolution cms.

As I read this thread, you have to have access to the server to create a virtual folder for eact subdirectory, or..?

Is it not possible for the admins just to set the parametres inside the cms system? :?: :?: :?:

13 Jun 03, 2006 13:16

rnink wrote:

I've read numerous responses to questions about using stub files and subdirectories, but struggled to find a complete answer ... at least to my questions. I think I've found a solution, and I wanted to share with others what seems to have worked for me.

If those of you with SO much more experience with b2evolution see any errors or problems with what I've done, please feel free to comment. :-)

Here's what's working for me (using 0.9.1 "Dawn"):
1. Rename Blog 2 or Blog 3 (or create a new blog) as Example Blog

2. Save a_stub.php as exampleblog.php (in the same root directory as the a_stub.php file). Open exampleblog.php and edit line 24, "$blog = 2;" with the number of your blog (the number to the left of the name of the blog on the "Blogs" tab in the admin section) and save.

3. Create a subdirectory for Example Blog (i.e. if your root directory is www.website.com/blogs, then your subdirectory could be www.website.com/blogs/exampleblog).

4. Open your new stub file, exampleblog.php. Edit line 58, "require(dirname(__FILE__)."/b2evocore/_blog_main.php");" by adding a "/.." just before "/b2evocore/_blog_main.php". It should now read "require(dirname(__FILE__)."/../b2evocore/_blog_main.php");". Save this second version of exampleblog.php under the new subdirectory, "www.website.com/blogs/exampleblog". Save it again, just as it is, as index.php under the same new subdirectory, "www.website.com/blogs/exampleblog".

I found I needed all three stub files. The one in the root directory is what b2evolution primarily references, but you need the index.php stub file in the subdirectory in case someone were to type in the entire URL, "www.website.com/blogs/exampleblog/index.php." You don't need this stub file when people type in "www.website.com/blogs/exampleblog" or "www.website.com/blogs/exampleblog/". You need the second "exampleblog.php" file in the subdirectory because when you link to the Example Blog blog from any other blog in your directory, it will link to "www.website.com/blogs/exampleblog/exampleblog.php" because of how things have to be set up in "Access Parameters" (see below, but for now just trust me :-)).

5. Now, go in to the admin section of your blog site (i.e. www.website.com/blogs/admin). Click on "Blogs" and the click on 'Example Blog". Under "Access Parameters" (the second section under the "General" tab) select the radio button next to "Other blog through stub file (Advanced)." For "Blog Folder URL" enter (using my example) "/exampleblog" following the given web address. For "URL Blog Name/Stub Name" enter (again, using my example) "exampleblog.php".

Fill out any other information you want to here, but this is what you need to do to make the stub file work.

6. Click on the "Settings" tab in the admin section. Under the "General" tab, third section "Link Options," check box for "Use extra-path info" and select the radio button "Post called up by its URL title (Recommended)" under "Permalink".

I think I've included all I had to do to be able to use stub files and subdirectories for a "marketing-friendly URL" such as www.website.com/blogs/exampleblog.

I've tried hard to follow this 'how to' create a stub file blog. However I've got problems I can't work out...

In the admin section I can create new posts to the new (stub file) blog, however when I goout of admin to the actual blog I click on the new blog and get the ' Sorry no new posts' yet if I go to 'Blog all' I can view the post I just created. Also it seems the new blog I've created is calling up the skin of the default blog. I know I must have a bit of code which I've missed but where?
URL is http://tangoaustralia.com.au/blog/calendar/index.php/calendar.php

15 Jun 03, 2006 19:15

antfarm wrote:

I've tried hard to follow this 'how to' create a stub file blog. However I've got problems I can't work out...

Technically this isn't really a "how to". It's more of a "how to do a hack" than "how to use b2evolution". Minor detail eh? If you absolutely want to have folders in your URLs then this is a good hack to work with. If all you want is to use stubs then you do not need most of what this is explaining. Just do like ¥åßßå says and make sure your stub file "$blog = N" bit matches the actual number of the blog. Then place the stub file in the folder that b2evolution lives in. Could be in yourdomain/ but it could be something like yourdomain/blog/ - depends on what you have.

16 Jun 04, 2006 12:35

EdB wrote:

antfarm wrote:

I've tried hard to follow this 'how to' create a stub file blog. However I've got problems I can't work out...

Technically this isn't really a "how to". It's more of a "how to do a hack" than "how to use b2evolution". Minor detail eh? If you absolutely want to have folders in your URLs then this is a good hack to work with. If all you want is to use stubs then you do not need most of what this is explaining. Just do like ¥åßßå says and make sure your stub file "$blog = N" bit matches the actual number of the blog. Then place the stub file in the folder that b2evolution lives in. Could be in yourdomain/ but it could be something like yourdomain/blog/ - depends on what you have.

Thanks for both your replies. I take both your points re blog number and folders. Actually I think my problem is something I was trying to achieve within my stub file from this thread about time stamping into the future ; http://forums.b2evolution.net/viewtopic.php?t=4175&highlight=future+blogs.
I'm trying to set up a web future event calendar. In fact I'd be really interested in any existing calendars out there using B2evo...? Just to see what's possible.

Thanks again.

17 Jun 08, 2006 15:11

I am very new to Blog's, and I have been reading about them and just installed this software. I want to be able to show my "News" blog in a designated area on my main index page for my web site. From what I have read using a stub file is the way to do this. I named my blog #2 "News" in the backoffice and I have modified the a_stub.php file to the correct blog # and renamed the new stub file to news.php. In the stub file I also modified the last line to the correct path to the news.php file. In the back office I selected the blog to be called by the stub file. I cannot get this to work at all. My stub file still has the <?php (in red) at the beginning of the file and the ?> (also in red) at the end of the file. Do I need to delete that code? And do I need any special code in my web page code to properly call the stub file?

If anyone can help I would greatly appreciate it. I have 4 blogs set up total which will probably get a good amount of use. The area in which I am trying to get this one to show up in is set as a table in the .html code at this time. I also saw another thread that talked about being able to show the most recent three posts of a blog on a main index page. I would love to be able to show the 1st post of each of the four blogs on my index page if that is easier than the stub file process.

Please help me, I would greatly appreciate it. Thank you.

18 Jun 09, 2006 11:33

In the stub file I also modified the last line to the correct path to the news.php file.

You shouldn't need to alter the last line.

You might want to take a look at summary.php (same folder as a_stub.php) as it's probably more what you want ;)

¥

19 Jun 19, 2006 12:21

Hmm, not working as intended for me or maybe I misunderstood what stub files are for.

Right now though I want to remove index.php from the URL.

My settings:
(Scenario #1)
Preferred access type: Other blog through stub file (Advanced)
Blog Folder URL: http://gameshogun.info/Shogun.php
URL blog name / Stub name: Shogun

And give me this URL result:
http://gameshogun.info/Shogun.php/Shogun

(Scenario #2)
If I change blog folder URL to /Shogun
it gives me http://gameshogun.info/Shogun/Shogun and a 404 Error.

(Scenario #3)
If I leave "blog folder URL" empty and change "URL blog name / Stub name" to Shogun.php
it gives me http://gameshogun.info/Shogun.php

(Scenario #4)
If I leave "blog folder URL" empty and the "URL blog name / Stub name" is jsut Shogun
it give me http://gameshogun.info/Shogun and a 404 Error.

I am using b2evolution 0.9.2 Sparkle.

Any help? Thanks.

20 Sep 23, 2007 01:22

I read the wiki/support item on stubfiles and subdirectories, but the stub file syntax apparently changed in 1.10. Instead of:

require(dirname(__FILEl__)."/b2evocore/_blog_main.php");

I see these two lines:

require_once dirname(__FILE__).'/conf/_config.php';
require $inc_path.'_blog_main.inc.php';

Which should I edit in what way for 1.10.

Thanks!


Form is loading...