b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Developer Reference
  3. How to... (Customize)
  4. How to call a blog through xyz.php instead of index.php?blog=x

How to call a blog through xyz.php instead of index.php?blog=x

This man page refers to b2evolution 0.9.2

Let's assume you have a default installation of b2evolution:

  • Blog All can be accessed through index.php?blog=1
  • Blog A can be accessed through index.php?blog=2
  • Blog B can be accessed through index.php?blog=3
  • The Linkblog can be accessed through index.php?blog=4

Let's start with Blog A

Let's start with blog A, because it is the easiest. b2evolution ships with an alternative file to call blog A! In your URL, try replacing the end index.php?blog=2 with a_stub.php. You should access the exact same page. That's because b2evolution ships with the file a_stub.php which is preconfigured for acting as if index.php was called with parameter blog=2.

However, if you now click on an internal link on this page, say "Last comments", you will notice that b2evo throws you back to index.php?blog=2 !

That's because b2evo doesn't know (yet) that you want to use a_stub.php instead of index.php?blog=2. You must set this up in the admin, under blogs then Blog A. Under "Preferred access type:", you must select "Explicit reference to stub file (Advanced)" and then name the stub file name in "Stub name:"; here you should enter a_stub.php. Validate your changes.

Now, you can refresh the blog page and click on some links. You will notice that you now stay on a_stub.php and no longer get redirected to index.php?blog=2.

Now with Blog B

Try the same operations as above on blog B (blog number 3) and try to associate it with a stub file named b_stub.php. You will notice that you get a "404 Page not found" error from your webserver!

That is because b2evolution does not ship with a file named b_stub.php !

Now try to duplicate the file a_stub.php as b_stub.php on your webserver.

What happens if you acces this page? You will notice that you no longer get an error, but b_stub.php displays Blog A just as a_stub.php did! This is not what you wanted!

This happends because b_stub.php contains preset parameters so that you don't have to pass these on the URL. In this case, it contains a hardcoding for blog=2 and blog #2 is blog A, not blog B. (You can see the blog numbers in the admin, under Blogs).

To correct that, you must open the file b_stub.php with a text editor and find the following line:


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

Replace this line with:


$blog = 3;

Take special care not to forget the $ sign in front of $blog, as well as the semi column ( ; ) at the end of the line. The white space and the comment after // can be omitted.

Save the file (and upload it to your webserver if necessary).

Calling b_stub.php should now work as expected. :)

The file b_stub.php is what we call a Stub File. You may have noticed that it also lets you set other parameters than just the blog number. For more information on this, see Stub File.

Created by fplanque • Last edit by fplanque on 2020-06-09 00:24 • •

On this page

  • Let's start with Blog A
  • Now with Blog B

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
    • Website Skins/Themes
    • Email Skins/Themes
    • b2evolution Files
    • Website Integration
    • Plugins
    • Debugging
    • Technical Reference
    • Hacks
    • Credits
    • Development
    • How to... (Customize)
      • How to upgrade a b2evo blog template to an evoSkin
      • Popup Comments
      • FTP 101: How to upload and manage files on your web server
      • Working with the Open Graph Protocol
      • How to - Use "honeypots" in your forms
      • I made a change but my blog is not updated
      • Turn A Skin Into A Template
      • Where is the Templates Tab?
      • Display Recent Posts In The Sidebar
      • Recent Comments In The Sidebar
      • Include Item Feedback
      • How to display comments, trackbacks and pingbacks UNMIXED
      • Change the way my blog looks
      • How to use b2evolution as a CMS
      • How to Show the Assigned Author of a post
      • How to change the "Read More" link
      • How to call a blog through xyz.php instead of index.php?blog=x
      • How to turn a Skin into a Template
      • How To use Pop-Up Comments in your evoSkin
      • How to add a smilie to your toolbar
      • How to display the posts' author
      • Dev Menu
    • Scheduled Tasks Reference
  • Operations Reference
  • Advanced Topics
  • Glossary
  • Archives
CMS + email marketing

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque