Recent Topics

1 Apr 14, 2007 02:40    

My b2evolution Version: 1.9.x

I am running two domains on my webhosting account: primary.com and secondary.org. B2evolution is installed in primary.com/blogs.

I would like to call a particular blog by entering secondary.org/particularblog.

I duplicated the file a_stub.php, and renamed it particularblog.php. I uploaded it to three different places: primary.com (inside public html), secondary.org, and primary.com/blogs.

The only one of these ways I can call particularblog is through primary.com/blogs/particularblog.php. The others return this message (with primary and particularblog substituted):
______
Warning: main(/home/primary/public_html/conf/_config.php) [function.main]: failed to open stream: No such file or directory in /home/primary/public_html/particularblog.php on line 58

Fatal error: main() [function.require]: Failed opening required '/home/primary/public_html/conf/_config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/primary/public_html/particularblog.php on line 58
______
Well, this is a lot more information than one usually gets as an error message, but I do not understand how to use it. It seems pretty obvious that I need to include in the stubfile in secondary.org where to look for the b2evolution installation, but I'm not clear how.

Line 58 of the stub file says:
require_once dirname(__FILE__).'/conf/_config.php';

I tried modifying it so it said:
require_once primary.com/blogs(__FILE__).'/conf/_config.php';
and uploaded that to secondary.org

but I got this message:
Fatal error: Call to undefined function: blogs() in /home/primary/public_html/secondary/particularblog.php on line 58

I could try random things all night, but maybe someone could advise me please?

2 Apr 14, 2007 04:50

martha wrote:

I tried modifying it so it said:
require_once primary.com/blogs(__FILE__).'/conf/_config.php';
and uploaded that to secondary.org

Don't know if you can get this to work with a stub file. In my memory it sais that I have read somewhere you can only use a stub file on the same server, but I can't find where I got that knowledge, if it exists.

Anyway, I quoted a line of your post for a purpose. There is an error in it that is easily corrected. In PHP you concatenate strings through a dot between them. So there should be a dot between primary.com/blogs and (__FILE__) - just like the dot after (__FILE__). And the string should be between '''s. This is correct:

require_once 'http://www.primary.com/blogs'.(__FILE__).'/conf/_config.php';


Perhaps it works.

Good luck.

3 Apr 14, 2007 07:50

OK, I tried that new code. I uploaded the changed file particularblog.php to the same three places: the primary.com/blogs folder, primary.com, and secondary.org. The result was that I could no longer call the blog using http://www.primary.com/blogs/particularblog.php --which had worked before.

I also notice that the line in question, line 58, does not have the dot you mention in the version that came from b2evolution: it reads:

require_once dirname(__FILE__).'/conf/_config.php';

I don't understand why you are wondering about the server. Both domains are on the same webhosting account, secondary.org is an "addon domain" of primary.com. Both the blogs folder and ALL of secondary.org reside INSIDE the public.html folder of primary.com.

So I'm still in search of a solution.

4 Apr 14, 2007 12:45

try:

require_once 'http://www.primary.com/blogs/conf/_config.php';


I misread the dirname(__FILE__), it's a function, not a string.

The problem with a blog on a diferent server is that it makes calles to many files and it presumes a base URL. If you call a blog from another_place.net it assumes that's where the files are.

You could redirect to your blog, or call it in a frame or an iframe. I think you should look for answers that in that direction.
Good luck.

5 Apr 14, 2007 12:58

Try this :-

require_once dirname(__FILE__).'/../blogs/conf/_config.php';

¥

6 Apr 15, 2007 01:45

Yabba--that works! Thanks! I can now get particularblog by entering secondary.org/particularblog.php.

When I click on anything (archives, leave a comment--e.g.s) the address line returns to primary.com/blogs/a_stub.php, however.

And PART of my goal in wanting the other path was to avoid primary.com, and part was to avoid leading users easily to the blogs page (where all the blogs are listed, with links). Is the new result as good as it gets? (I think I'll upgrade from 1.9.2 to 1.9.3, see what happens.)

7 Apr 15, 2007 09:12

In your blog settings for particularblog, set the blog folder url to absolute url and enter http://secondary.org/particularblog.php

Then set preferred access type to automatic detection by index.php

Hit save and your links should all change to something like what you're after.

¥

8 Apr 15, 2007 22:58

¥åßßå to your knowledge is there any way to utilize the stub files to be able to call a blog from a domain that is not a subdomain of the domain where the B2evolution installation is done?

9 Apr 15, 2007 23:09

OK, I tried that. I can get to the back office, but exit to blogs now returns an error message. I can get to the blog, but clicking on anything returns the old primary.com/blogs url sometimes, OR an error message. Also, the test posts I have up are all "protected (members only)" status, and so the blog used to show without posts until one logged in. Now it shows without posts even logged in as a test member, or as admin. (The posts show up in the back office, however, so they are still there.)

The "url preview" at the bottom of the blogsettings/general page now reads:
http://secondary.org/particularblog.phpindex.php
That can't be right--can it?

Now what?

10 Apr 16, 2007 09:42

samredman wrote:

¥åßßå to your knowledge is there any way to utilize the stub files to be able to call a blog from a domain that is not a subdomain of the domain where the B2evolution installation is done?

If we can get this one working then "yes" :D

martha wrote:

The "url preview" at the bottom of the blogsettings/general page now reads:
http://secondary.org/particularblog.phpindex.php
That can't be right--can it?

Ok, lets try a slight change :-
Change the absolute url to just http://secondary.org/
Change the access type to stub file and type in particularblog as the stub Filename and the URL blog name

Hit save and cross yer fingers ;)

¥

11 Apr 17, 2007 03:29

I had thought of the same thing, and tried it. It gives the desired path under url preview. But: even when I am logged in, it will not show the protected posts. (They show up under the full posts tab in the back office, and were displaying on the blog when a user was logged in before.) Also, when I exit to blog the "login" option is visible, not the "logout"--and if I hit it, I wind up stuck outside: the login screen says I am logged in (as admin or as martha, as the case may be), but hitting "continue" after that gets a 404 error. Logging in again gets an incorrect user or password message.

Clue (but how to use it?): the title to the left of the urls we've been adjusting says "Blog Folder URL." And my blogs folder is in primary.com. Actually, inside the public html folder, along with all of secondary.org. To have the address I want, b2e needs to find the re-named stub file in secondary.org. But the renamed stubfile redirects it a step up, to the blogs folder which sits next to secondary.org inside the public html folder of primary.com. The stub file tells it that, but it seems the blogsettings>general setting also tells it where to find the blogs folder... but, in this case, not telling it to go up a step. But if we tell it that here, don't we get a convoluted path in the url preview screen.

I'm confused.

12 Apr 18, 2007 10:47

Any chance of a link to the domains where this is happening?

¥

13 Apr 20, 2007 10:09

Sorry for the delay in replying to your PM, but I got a smidge busy .... actually, that's not entirely true, it's because it's been sunny here the last few days and on the offchance that this was our summer I went and sat in the garden with a beer :D

From looking at your two domains it would seem that you definately have your settings wrong still, but even if they were correct you'd still have the "can't see protected posts" problem. The reason for this is because you login via primary.com and all the cookies and stuff are set for there, but when you visit secondary.org you're not logged in .... and never can, because you end up on primary.com to login.

The easiest cure that I can think of is this :-

1) Move all of your blog files from the /blogs/ folder to /secondary.org/ subfolder

2) Create a .htaccess for primary.com/blogs/ which rewrites the path to primary.com/secondary.org/

3) Change your blog settings so that they're correct

4) Make a minor modification to $baseurl in /conf/_basic_config.php so that it always points to the "current" domain

The result should be that each blog will think that it's a full installation and you can log into both of them individually ( and have the login "stick ).

This probably sounds a lot harder than it really is, but it's pretty much how I run my own multi-domain / multi-subdomain blogs.

¥

14 Apr 20, 2007 17:27

Thanks! It'll be early next week before I can try this (my own busy + sunny)--will report results when I have some.

15 Apr 22, 2007 04:24

This seems very interesting, do you think we can have a DOC for the steps on how to set this up

I have been struggling to set up subdomain. I am still stuck ;-(

But nice job Yabba

16 Apr 24, 2007 21:20

OK, let's take this one step at a time.

"1) Move all of your blog files from the /blogs/ folder to /secondary.org/ subfolder"

Do you mean the equivalent of copying the /blogs/ folder to secondary.org and renaming it /subfolder/? This folder is the /blogs/ folder from the b2evolution download, with install deleted, changed stub file, and some changes to skins.

Or do you mean a separate /subfolder/ for each blog (or group of blogs) that I want to behave as if it were a separate installation? If so, how do I tell which parts?

17 Apr 25, 2007 02:12

Where ¥åßßå used the word 'move' he meant 'copy'. What he wants you to do is make a complete setup of the blog at the secundairy host. You can put that in any folder you like: root (messy) or ../blogs/ or ../subfolder/
The idea is to let both blogs point to the same database (on the primairy host), so the messages are equal.
Next you change the config file (base url => secundairy host).
Next you create stub files in which you can disable certain categories or blogs and make the url look the way you want.
¥åßßå also mentions certain blog settings that are not correct at this time.

18 Apr 25, 2007 09:44

Close, where I said "move" I meant "move" ( as in copy the files that are currently in primary.com/blogs/ to primary.com/secondary.org/ and then delete the files from primary.com/blogs/ )

Then in primary.com/blogs/ you create an htaccess that does a rewrite to ../secondary.org/

In primary.com/secondary.org/conf/_basic_config.php you change the $baseurl like so :-

$baseurl = ( strpos( $_SERVER[ 'HTTP_HOST' ], 'secondary.org' ) ? 'http://secondary.org/' : 'http://primary.com/blogs/' );

The result of this is that you have a single install which both domains will "see" as a full install complete with admin and login etc.

You'd then need to change each blogs settings to reflect that.

¥

*edit*
wayra wrote:

This seems very interesting, do you think we can have a DOC for the steps on how to set this up

I have been struggling to set up subdomain. I am still stuck ;-(

Sorry Wayra I wasn't ignoring you. The problem with me trying to do any docs for this is that I run a dedi *cough*windows*cough* box and so I do things vastly different ( I use IIS instead of htaccess etc ). The basic principles are the same but the methods of getting from A to B are very different.

19 May 12, 2007 08:16

ok, i'm having the same problem...with the user not being able to "logout" and all...

here's my setup.
I got domain1.com and domain2.com.
domain1.com points to / and blog files are in /b2e/
domain2.com points to /domain2/

I put all the stub files in /domain2/ so if i enter www.domain2.com, it'd take me to the blogs.

like the poster(s) above, I had to edit line 58

now, when i access domain2.com, it shows the default blog, but when I log in, it doesn't log me in, though I can get into backoffice.

i guess my question would be what would the .htaccess look like to rewrite the path?


Form is loading...