How can include blog.php?

How can include blog.php?

Postby markvp on Mon Jan 25, 2010 5:09 am

Hi,

I want to incorporate my blog into my existing website, so that the design and menu of my site are on the page. I did this following the example that uses the API, but I'm not satisfied with this, because the comments, the calendar etc. are not on the page. Maybe I can add these as well using the API, but I thought of a simpler solution: simply include blog/index.php in a page that also shows my website menu. Alas blog/index.php generates the <html> and <body> tags, which end up inside my own <body> tag. The end result is that the blog is not displayed.

Is there a solution to this problem? It would be great if generating the <html> and <body> tags could be turned off. Looking at the code in blog/index.php doesn't help me.

Regards,

Mark
markvp
 
Posts: 4
Joined: Mon Jan 25, 2010 4:25 am
LifeType Version: 1.2.9

Re: How can include blog.php?

Postby jondaley on Mon Jan 25, 2010 2:42 pm

Do you need to access the blog outside of your included website? ie. can you edit the template to not use the <html><body> tags? Though, I think you'll run into trouble with HTTP headers being sent by the software. You can grab everything through the API, but might be a bit of a pain. How about an iframe?
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: How can include blog.php?

Postby markvp on Tue Jan 26, 2010 9:16 am

Hi,

I didn't know that the <head> and <body> tags are in the templates, not explicitly generated by Lifetype.

However I tried removing them from the template in header.template and footer.template, but for some reason nothing of what I include is shown. Not even an error message. Must be something with the http headers that you mention.

Iframes are said to be no good for search engines, and I want my site to be indexed well, so that is not an option.

I'll try making it better using the API.


Mark
markvp
 
Posts: 4
Joined: Mon Jan 25, 2010 4:25 am
LifeType Version: 1.2.9

Re: How can include blog.php?

Postby jondaley on Wed Jan 27, 2010 8:54 am

Yeah, I figured the iframe solution wasn't going to be good for you, but figured I'd mention it, in case it didn't matter to you.

Does your server give you access to the error logs - PHP should be outputting an error message if it is the header problem. You also might be able to see the error messages using ini_set() and display_errors=true or things like that, depending on your host's configuration.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: How can I include blog.php?

Postby markvp on Thu Jan 28, 2010 7:17 am

I turned on displaying errors, and then I get:

Notice: Undefined index: REMOTE_ADDR in /var/www/html/q-mentum/blog/plugins/badbehavior/bad-behavior/blackhole.inc.php on line 48

Warning: Smarty error: unable to read resource: "./templates/default/main.template" in /var/www/html/q-mentum/blog/class/template/smarty/Smarty.class.php on line 1092


I don't understand the second warning, in the folder templates\default there is only a file called commentform.template. But I guess the first points to the problem.
markvp
 
Posts: 4
Joined: Mon Jan 25, 2010 4:25 am
LifeType Version: 1.2.9

Re: How can include blog.php?

Postby jondaley on Fri Jan 29, 2010 1:32 am

#1: badbehavior tries to figure out whether you are a spammer/hacker by various means, and if it can't get your ip address, it won't be able to do as good a job. I am not sure what is means to not have REMOTE_ADDR set. How are you accessing lifetype? ie. are you running a php command line version?

#2: It sounds like your template doesn't have a main.template in it, and so it is defaulting to the default template, which also doesn't have a main.template. You should have a main.template in whatever template directory you have picked.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: How can include blog.php?

Postby markvp on Fri Jan 29, 2010 7:00 am

#1 I just use PHP as installed by my webhoster. But I had a look at the code, the error is in the function bb2_httpbl, which is only called from core.inc.php, where 'REMOTE_ADDR' is not added as a key to the array called $package.

I therefore visited the ordinary blog page (i.e. without my include trickery), and as I expected the same error appeared again in the error log.

#2 I downloaded Lifetype 1.2.9 again, and there is no file ./templates/default/main.template. I did experiment using different templates, but I set it back to 'standard', not 'default', and the ./templates/standard folder does contain a file called main.template. Anyway, the blog looks good when viewed the usual way.
markvp
 
Posts: 4
Joined: Mon Jan 25, 2010 4:25 am
LifeType Version: 1.2.9

Re: How can include blog.php?

Postby jondaley on Fri Jan 29, 2010 2:10 pm

#1: okay, I'll take a look at it. I haven't seen that error on my installations, so I figured it was something local to you.

#2: The "default" directory does not contain a main.template, but all "regular" templates should, and it is a required file to view categories, the main page, archives, etc.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: How can include blog.php?

Postby jondaley on Sat Jan 30, 2010 1:14 am

I updated to the latest bad behavior plugin and he has already fixed the line you mentioned.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch


Return to Configuration and Installation