Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Aiheen aloitti: guppy - helmikuu 25, 2005, 07:21:33 AP

Otsikko: Using SSI.php in blogs
Kirjoitti: guppy - helmikuu 25, 2005, 07:21:33 AP
Hi, I'm trying to use SSI.php to show forum info on my blog - Simple PHP Blog aka sphpblog

I added <?php require("/mu_absolute_path/forum/SSI.php");?> at the top of all "affected" files (those that generate error that the smf functions are not defined) but I'm getting this error

LainaaWarning: Cannot modify header information - headers already sent by (output started at /my_absolute_path/a_sphpblog_directory/a_sphpblog_directory_file.php:3) in /my_absolute_path/a_sphpblog_directory/a_sphpblog_directory_file.php on line ...

I was suggested to use ob_start() and ob_flush() but it didn't solve the next problem, that is I get auto logged out of my blog. Erm.. I cleared my IE browser cookies and I was able to stay logged in after that, but after I logout, I get the same auto logged out problem and clearing cookies don't help.

Silly question but can SSI.php be used on a dynamic site such as a blog? or can it only be used on a single page? Sorry, maybe this is not a genuine smf qn per se but i'ld really prefer to have smf stuffs like menubar and recent posts on my blog  :'(

Thanks for your patience..
Otsikko: Re: Using SSI.php in blogs
Kirjoitti: Elissen - helmikuu 25, 2005, 07:36:10 AP
Did you place that before all other includes/requires?

I glanced at that blog system and it looks like all files (like comments.php ect) include scripts/sb_functions.php. You can edit that file alone and start the file as:
<?php
ob_start();
require('/path/to/smf/SSI.php');
Then you shouldn't need to edit all other files.
Make sure there are no spaces before the <?php
Otsikko: Re: Using SSI.php in blogs
Kirjoitti: guppy - helmikuu 25, 2005, 09:14:18 AP
thanks for taking a look  :)

this is what i did:

1. tried your suggestion - no more warning but auto logout of blog
2. cleared cookie - stay logged in but can't logout

LainaaFatal error: session_start() [function.session-start]: Failed to initialize session module in /my_absolute_path/scripts/sb_login.php on line 30

3. tried to add a blog post but get the first warning about modifying header info but the post is added properly

4. smf quick login worked fine

i hope to understand if it's more of an smf issue or more of the blog issue. thanks for helping.

p/s: cute avatar  :D
Otsikko: Re: Using SSI.php in blogs
Kirjoitti: Elissen - helmikuu 25, 2005, 09:46:48 AP
Lainaus käyttäjältä: iwyen - helmikuu 25, 2005, 09:14:18 AP
...
LainaaFatal error: session_start() [function.session-start]: Failed to initialize session module in /my_absolute_path/scripts/sb_login.php on line 30
...
might be an issue with both SMF and the blog starting a session.

You might want to look at the smf_api.php (http://www.simplemachines.org/community/index.php?topic=16572.0) as well (as a replacemet for ssi.php).
Otsikko: Re: Using SSI.php in blogs
Kirjoitti: guppy - helmikuu 26, 2005, 10:27:28 IP
thanks! i've tried the file but i wonder if i used it correctly. i added smf_api.php in smf folder and changed sb_functions.php to require smf_api.php instead of SSI.php but i get this error

LainaaFatal error: Call to undefined function: ssi_menubar()

so i added to require smf_api.php and SSI.php but having the same problem as just using SSI.php

did i use it correctly?? thanks
Otsikko: Re: Using SSI.php in blogs
Kirjoitti: Elissen - helmikuu 27, 2005, 07:56:49 AP
SSI.php and smf_api.php and NOT the same and I think smf_api doesn't offer ssi_menubar I think. The api is ment to make some things easier, but NOT as a replacement for SSI.php
Otsikko: Re: Using SSI.php in blogs
Kirjoitti: guppy - helmikuu 27, 2005, 09:36:45 IP
hmm... i shall continue to ponder. thanks for your help!  ;)