Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Tomer on June 23, 2004, 05:06:24 AM

Title: Basic SSI FAQ
Post by: Tomer on June 23, 2004, 05:06:24 AM
Basic SSI FAQ

Hello and welcome to the Basic SSI FAQ, in this FAQ you will learn the basics of whats SSI, can it be used to my needs and how, this FAQ has commonly asked SSI questions as well as tips and tricks, you will also find a list of attached scripts to the end of this post that may help you with what you have learned in this FAQ. If at the end you still have questions or comments, please post them.
Your feedback if very imporant to me.

**PLEASE DO NOT EDIT YOUR 'SSI.PHP' FILE**
Everything done here is done without having to edit 'SSI.php'


Whats SSI?

SSI - Server Side Includes, is a feature we use to help link our community board to the rest of our site, it also helps us take forum stats, news, announcements, recent posts...etc and view those things on other pages in our site.


How Can SSI Help me?

Even you can find use with SSI, lets take an example:

Example:

You have a site, and also a forum, and you want that when members are logged in, they will see a special downloads area on the downloads screen.

For something like this, SSI is needed and can be created in minutes


Fine SSI is good, how do I start using it?

The first thing you need to do is open a new file somewhere in your site, and give it a .php extention. Then open your text editer for that file and write this code:


<?php
require("/home/simple/public_html/forum/SSI.php"); 
?>


But make sure the path is the correct path for you to the 'SSI.php' file located in your forum directory, to see YOUR correct path, check out the top part of 'ssi_examples.php' file located in your forum directory.


Ok I got the correct path to 'SSI.php', whats next?

Ok if you have got your correct path to SSI.php and written it in the file you created in the format I showed above, then good job.
Next we will try to add features to your page [eg. menu bar, whos online list...etc]. Try this code between the 'require...' statement and the '?>' code


ssi_menubar();


Now try going to your page in your browser, if everything went well, you should see your menu bar from your forum, if you dont see anything there or some error message, that is probaly because you didnt write that correct path to your 'SSI.php' file.
Well now that you got this working, you can go have fun with it, you can add many functions to your page, all the functions are listed in the 'ssi_examples.php' file located in your forum directory. [Also your correct 'SSI.php' path is listed in that file at the top]


That was cool, anymore?

Yes, there is more to SSI then the functions, now I will show you how the user premissions works with showing you how to write this example:

Example:

You have a site, and also a forum, and you want that when members are logged in, they will see a special downloads area on the downloads screen.
This is easy stuff to do, and I will show you how using PHP's 'if' statement:


<?php
require("YOUR_PATH_TO_SSI.php"); 

if (
$context['user']['is_guest'])
 {
   echo 
   
'<h5>Access Denied</h5>
   We are sorry guest, it seems you dont have premission to view these downloads.'
;
 }
else
 {
   echo
   
'<h5>Welcome '$context['user']['name'], '!</h5>
   Here are your downloads:'
;
 }
?>



I will explain the script I have written above:
The 'if' statments works on true and flase, if the statement [In our case: ($context['user']['is_guest'])] is true, the first block is activated, and if false, the 'else' block is activated.
So in our case, if you aren't logged in [You are a guest] you will see an access denied message, and if you are logged in, you will see the downloads area. You can use that in any way you wish.

You can do the same thing but with admin


if ($context['allow_admin'])
  {
   Block of statements
  }
else
  {
   Block of statements
  }



Well this pretty much covers the basic Guide, the next guide is: 'Advanced SSI FAQ (http://www.simplemachines.org/community/index.php?topic=13016.0)'.

Attached to the end of this post are some sample scripts that may help you out.

If this FAQ has helped you in any way please post in this thread your opinions of it, what was unclear, confusing...etc
Your feedback is very important to me. :)

Thanks

-Lamper
Title: Re: Basic SSI FAQ
Post by: Owdy on June 23, 2004, 12:47:19 PM
Dont forget .shtml version... http://www.simplemachines.org/community/ssi_examples.shtml
Title: Re: Basic SSI FAQ
Post by: TodaysXt on June 23, 2004, 06:27:27 PM
I think it's helpful and want to read the advance section.  I had the bare min. on my page but now I know how to use the "if ($context['user']['is_guest'])," with this.
Thanks for your work
Xt.
Title: Re: Basic SSI FAQ
Post by: Tomer on June 23, 2004, 06:31:17 PM
Thanks, I will write the advanced soon.
Title: Re: Basic SSI FAQ
Post by: Cypher7 on June 23, 2004, 06:34:51 PM
Yea, great work.

I really wanted to use SSI, but hadn't a clue how to implement it...! And that FAQ was all I needed to get started!

Now I can go have some fun!  ;D
Title: Re: Basic SSI FAQ
Post by: Tomer on June 23, 2004, 06:35:50 PM
Thanks a lot! :d Really means a lot of I helped someone.

Anyone got any hints on how to make it better, something that wasnt clear, confusing, anything?
Title: Re: Basic SSI FAQ
Post by: Cypher7 on June 23, 2004, 07:02:13 PM
Quote from: Lamper on June 23, 2004, 06:35:50 PM
Thanks a lot! :d Really means a lot of I helped someone.

Anyone got any hints on how to make it better, something that wasnt clear, confusing, anything?

nope, it was pretty clear to me! And I have NO clue about php!

only thing I could see was a typo  :P

QuoteThe 'i'f statments works on true and flase

Title: Re: Basic SSI FAQ
Post by: Tomer on June 23, 2004, 07:03:39 PM
Fixed.

Check out the sample scripts attachched to the first post.
Title: Re: Basic SSI FAQ
Post by: Cypher7 on June 23, 2004, 07:10:49 PM
oooh, that welcome one is nice! and so simple!

I'll be using that one!!
Title: Re: Basic SSI FAQ
Post by: Rpg Cyco on June 24, 2004, 01:51:25 AM
Great work Lamper, helped me a lot. :)

l8ter

Rpg Cyco
Title: Re: Basic SSI FAQ
Post by: Tomer on June 24, 2004, 03:04:00 AM
Thanks. :)
Title: Re: Basic SSI FAQ
Post by: Anguz on June 24, 2004, 10:46:52 AM
good work Lamper (^_^)

some may find it useful to know if they can restrict access to different areas depending on other membergroups other than Guest or Admin
Title: Re: Basic SSI FAQ
Post by: mcdougrs on June 24, 2004, 03:43:30 PM
VERY nice Basic Tutorial!! I can't WAIT for the Advanced version of it, especially if you could explain the array output method a little more in that one!!  :o

If someone could Sticky this I think that would be useful
Title: Re: Basic SSI FAQ
Post by: Tomer on June 24, 2004, 04:35:22 PM
Quote from: Anguz on June 24, 2004, 10:46:52 AM
good work Lamper (^_^)

some may find it useful to know if they can restrict access to different areas depending on other membergroups other than Guest or Admin

Expert SSI FAQ :)

Quote from: mcdougrs on June 24, 2004, 03:43:30 PM
VERY nice Basic Tutorial!! I can't WAIT for the Advanced version of it, especially if you could explain the array output method a little more in that one!!  :o

If someone could Sticky this I think that would be useful

Advanced SSI FAQ :)
Title: Re: Basic SSI FAQ
Post by: Tomer on June 30, 2004, 08:29:56 PM
Here.


<?php

if ($context['user']['is_guest'])
   {
      echo 
''$txt['welcome_guest'], '';
   }
else
   {
      
ssi_welcome();
   }

?>
Title: Re: Basic SSI FAQ
Post by: Cypher7 on July 01, 2004, 07:40:39 PM
Cheers Lamper,

thanks to that and your FAQ's I now have some SSI on my main site airport-tkd.com (http://airport-tkd.com)!!

Nothing special, but I'm happy with it!

cheers!  :)

Jay K
Title: Re: Basic SSI FAQ
Post by: Ben_S on July 02, 2004, 07:06:08 PM
Is your home page suppose to scroll 7 miles to the right?
Title: Re: Basic SSI FAQ
Post by: Cypher7 on July 04, 2004, 05:58:35 PM
Darn, no, its not! Just checked it in Firefox... doesn't happen in IE is why I didnt notice it... I checked in firefox before I made some changes and it was fine...

tsk... and I dont have the time to go fix it... will have to wait a day or two! ah well!

Thanks for the heads up anyway...
Title: Re: Basic SSI FAQ
Post by: Vinoth on July 07, 2004, 06:38:37 AM
fantastic work lamper/

1000 Beers to you.
Title: Re: Basic SSI FAQ
Post by: Tomer on July 07, 2004, 08:30:11 AM
I prefer Root Beer, but thanks. :D
Title: Re: Basic SSI FAQ
Post by: Secret on July 14, 2004, 05:48:18 PM
hey, is there a way where you can include the login boxes right there so they dont have to go to the forum to log in. Then if they log in show them the downloads
Title: Re: Basic SSI FAQ
Post by: Tomer on July 15, 2004, 06:44:22 AM
Quote from: Secret on July 14, 2004, 05:48:18 PM
hey, is there a way where you can include the login boxes right there so they dont have to go to the forum to log in. Then if they log in show them the downloads


<?php

if ($context['user']['is_guest'])
   {
      
ssi_Login();
   }
else
   {
      echo 
"Downloads section!";
   }

?>

Title: Re: Basic SSI FAQ
Post by: smarechal on July 27, 2004, 11:12:55 AM
Hi,

i tried SSI, but i've got this message

QuoteWarning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/webnatur/www/index.php:6) in /home/webnatur/www/yabbse/SSI.php on line 93

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/webnatur/www/index.php:6) in /home/webnatur/www/yabbse/SSI.php on line 93

Warning: Cannot modify header information - headers already sent by (output started at /home/webnatur/www/index.php:6) in /home/webnatur/www/yabbse/SSI.php on line 96
Salut, smarechal, vous avez 0 messages, 0 sont nouveaux.



Do you know what is it?

thanks
Title: Re: Basic SSI FAQ
Post by: Owdy on July 27, 2004, 11:24:44 AM
Is your include on the1st line? It must be in first, before anything.
Title: Re: Basic SSI FAQ
Post by: smarechal on July 28, 2004, 05:02:12 AM
Thanks!  :D

I've got another question.

(i try to speak english well   lol)

I want to put on my index page (http://www.webnature.net/index.php?page=accueil) some news i post in special topic (http://www.webnature.net/yabbse/index.php?topic=24.0).

Can i write a fonction to show the last topic on a define board with SSI?

Thanks a lot for your help
Title: Re: Basic SSI FAQ
Post by: PsyKo BoY on July 28, 2004, 08:23:05 AM
hello

hum I try this little help but for some reasons it doesn't work...on my forum all is ok, I'm considerated as loggued but on this script I'm considerated like a guest !
Here is my code


<?php

require("SSI.php");

if (
$context['user']['is_guest'])

   echo 
   
'<h5>Access Denied</h5>
   We are sorry guest, it seems you dont have premission to view these downloads.'
;

else

   echo
   
'<h5>Welcome '$context['user']['name'], '!</h5>
   Here are your downloads:'
;

?>



Exactly the same as posted before...this file and the SSI one are in the same folder.

++Edit++
Ok no more porbleme
I wasn't using the adress specified in the forum script options...
++
Title: Re: Basic SSI FAQ
Post by: Redeye on October 17, 2004, 03:46:03 AM
I've put the ssi_recentposts function on my web site page and it's working corrctly.

The problem seems to be that when members go to the forum the "Show unread posts since last visit" function shows no new when there are new posts.

Any idea why?

TIA
Title: Re: Basic SSI FAQ
Post by: umiya on October 17, 2004, 06:49:42 AM
any way to make it so that the pool fucntion is visible no matter what....and you can even vote??

i wa u sing my own poll script but thought hey why not use the ssi stuff....but iv come to find out that u cant see the poll if ur not logged in
Title: Re: Basic SSI FAQ
Post by: Anguz on October 17, 2004, 08:04:41 AM
It should be shown to guest visitors if that permission is set in your admin area.
Title: Re: Basic SSI FAQ
Post by: umiya on October 17, 2004, 08:35:00 AM
wher is this part in admin panel...only thing i saw was to diable/enable it  and to show old polls as topics

edit-i found it and it is set for guest to view polls.......

Title: Re: Basic SSI FAQ
Post by: quake101 on October 19, 2004, 11:55:58 AM
I'm using SSI (I use ssi_welcome)on my site already, but I'm having problems with this:
<?php
require("forums/ssi.php");

if (
$context['user']['is_guest'])
{
   echo
   
'<h5>Access Denied</h5>
   We are sorry guest, it seems you dont have premission to view these downloads.'
;
}
else
{
   echo
   
'<h5>Welcome '$context['user']['name'], '!</h5>
   Here are your downloads:'
;
}
?>


This code only give me "Welcome ! Here are your downloads:", it doesn't matter if i'm loged in or not I still get that. Does this not work with 1.0 RC1?
Title: Re: Basic SSI FAQ
Post by: Elissen on October 19, 2004, 01:45:26 PM
Strange, that script does work for me on RC2 (don't have a RC1 running anymore, but it should also work on RC1).

Put
error_reporting(E_ALL); right below the <?php before the require to see if anything goes wrong and your server hides it. I had to change ssi.php to SSI.php tough (Linux server, case sensitive)
Title: Re: Basic SSI FAQ
Post by: quake101 on October 20, 2004, 11:27:53 AM
Quote from: Elissen on October 19, 2004, 01:45:26 PM
Strange, that script does work for me on RC2 (don't have a RC1 running anymore, but it should also work on RC1).

Put
error_reporting(E_ALL); right below the <?php before the require to see if anything goes wrong and your server hides it. I had to change ssi.php to SSI.php tough (Linux server, case sensitive)

I upgraded to RC2 last night to see if that helped and it didn't. :( I also made sure I was using SSI.php and it looks like I am. What I don't get is all the other ssi functions work, I tested almost all of them with no errors. When I use "error_reporting(E_ALL);" I get....

Notice: Undefined variable: context in /home/quake101/public_html/bad/downloads.php on line 15
Welcome
Notice: Undefined variable: context in /home/quake101/public_html/bad/downloads.php on line 24
!
Title: Re: Basic SSI FAQ
Post by: Elissen on October 20, 2004, 02:26:07 PM
Then it doesn't see the context var. Try this:
<?php
require("forums/SSI.php");

global 
$context;

if (
$context['user']['is_guest'])
{
 echo
 
'<h5>Access Denied</h5>
 We are sorry guest, it seems you dont have premission to view these downloads.'
;
}
else
{
 echo
 
'<h5>Welcome '$context['user']['name'], '!</h5>
 Here are your downloads:'
;
}
?>


What PHP version is running on your server btw?
Title: Re: Basic SSI FAQ
Post by: quake101 on October 20, 2004, 03:59:03 PM
Woah, It works when you global $context. I didn't think of that one. :)
btw, the server is running PHP Version 4.3.4
Title: Re: Basic SSI FAQ
Post by: Elissen on October 20, 2004, 07:10:16 PM
Hmm, mine is running 4.3.9-1. Probaly some configuration difference then. Anyway, it works :)
Title: Re: Basic SSI FAQ
Post by: Kender on November 10, 2004, 08:31:43 PM
how would i get it to say,,

Welcome: {username}

without the you haev X messages X unread messages

Title: Re: Basic SSI FAQ
Post by: Kender on November 10, 2004, 10:47:19 PM
resolved, needed to global $context;
Title: Re: Basic SSI FAQ
Post by: ebsq on November 29, 2004, 05:53:55 AM
I think this is a relavant question (and I tried to find the answer elsewhere...)...

What about the other way around... I see how you can use SSI to manage access to your site - but what if you already have an extensive database with user information and want to use it's data to manage logins (that doesn't make sense... I want to grant access to SMF via my data/login/etc...  is this a common need and has anyone addressed it?)  Currently we are using YABB and we have to manage two sets of logins/passwords - not to mention how confusing it is to our members.  (Obviously this is my problem, not YABB/SMFs... but it would be nice if there were a simple solution... I can think of a few difficult ones)

Thanks...  love what is going on here... am holding out for the final release of version 1!

bill
Title: Re: Basic SSI FAQ
Post by: [Unknown] on November 29, 2004, 07:48:20 AM
Obviously, you can't use SSI.php to do what you're asking.  It's a separate topic all together.

There aren't many files you need to modify to change authentication, but I would suggest either:
  - mirroring the login information in the members table SMF uses, and when the password is changed in SMF update it on your side.
  - just using SMF's authentication and porting over the username and password data.

This is because the members table information is used for a lot more than simply the username and password.

-[Unknown]
Title: Re: Basic SSI FAQ
Post by: bunkfilms on December 08, 2004, 10:14:09 PM
I seem to be having an odd issue with this, or maybe my php knowledge (the require statement). I know the absolute path to my SSI.php file, but I can only get the functions to work if my file for instance, testssi.php is in the same directory of my SSI.php file, regardless if I know my require statement is pointing to the corret path. If I move my test file out of that director, it fails on the require, giving me a blank page. I'm stumped.
Title: Re: Basic SSI FAQ
Post by: [Unknown] on December 09, 2004, 02:58:51 AM
Quote from: bunkfilms on December 08, 2004, 10:14:09 PM
I seem to be having an odd issue with this, or maybe my php knowledge (the require statement). I know the absolute path to my SSI.php file, but I can only get the functions to work if my file for instance, testssi.php is in the same directory of my SSI.php file, regardless if I know my require statement is pointing to the corret path. If I move my test file out of that director, it fails on the require, giving me a blank page. I'm stumped.

There's nothing we can really do without knowing the path you're trying to use...

It's possible your other paths are incorrect - you can check and fix them by using repair_settings.php.  What is repair_settings.php? (http://www.simplemachines.org/community/index.php?topic=18096.0)

-[Unknown]
Title: Re: Basic SSI FAQ
Post by: bunkfilms on December 09, 2004, 12:05:37 PM
The path is this:

<?php require("/home/business/public_html/forums/SSI.php");  ?>

Which is correct, and works on the same file, if I copy it to the forums directory and access it from there.  I realize it is more of a php issue than SMF, but appreciate any thoughts as to why the require would not be working with the correct path
Title: Re: Basic SSI FAQ
Post by: [Unknown] on December 09, 2004, 10:50:39 PM
If the path is correct, I can almost be certain it's *other* paths - perhaps starting with "./".  Did you check repair_settings.php?

-[Unknown]
Title: Re: Basic SSI FAQ
Post by: GiNi3D on December 09, 2004, 11:49:51 PM
@bunkfilms
Did you try your domain name>>  <?php include ('http://www.yourDomainName.com/forums/SSI.php'); ?>
Title: Re: Basic SSI FAQ
Post by: [Unknown] on December 10, 2004, 01:25:25 AM
Quote from: GiNi3D on December 09, 2004, 11:49:51 PM
@bunkfilms
Did you try your domain name>>  <?php include ('http://www.yourDomainName.com/forums/SSI.php'); ?>


That is the wrong way to do it, I'm afraid.... unless you just want to load certain SSI functions without being able to access the other benefits of SSI.php.

-[Unknown]
Title: Re: Basic SSI FAQ
Post by: GiNi3D on December 10, 2004, 01:59:25 AM
Quote from: [Unknown] on December 10, 2004, 01:25:25 AM
That is the wrong way to do it, I'm afraid.... unless you just want to load certain SSI functions without being able to access the other benefits of SSI.php.

-[Unknown]
I guess you are right, I actually never tried the SSI functions; I guess I will pass these kinds of questions until I know more...  ;)
Title: Re: Basic SSI FAQ
Post by: bunkfilms on December 10, 2004, 07:14:05 AM
Just wanted to thank you for correcting me. The solution you provided did work and got me to fix all the variables to the recommended settings! 

Now I begin the difficult task of making the SSI.php work with my Geeklog (geeklog.net) CMS system.  I have read several places on here where users strongly encourage NOT to modify the SSI.php code.  The problem with using SMF with my geeklog site is some of the variables cross over (have the same names) and you can't redeclare a function, such as db_query which both systems use.

Yes, yes, I know geeklog has it's own itegrated forums, but I was raised on YabbSE and have stuck with it through SMF because it is the BEST forums package out there. The best.  So I rather use it than having something totally integrated.  But having some of the SSI.php tools work on the main site would be nice. I will post back if I get anything to work.

Thanks again for your time and help.
Title: Re: Basic SSI FAQ
Post by: Elissen on December 10, 2004, 07:23:56 AM
If you conflicting variable/function names you might be interested in using smf_api.php (http://www.simplemachines.org/community/index.php?topic=16572.0)

Quote from: [Unknown] on September 12, 2004, 07:39:35 PM
The purpose of this tool is to facilitate easy integration of SMF into other scripts and software. Previously, this was done with SSI.php, but that pulls in most of SMF and can become very bloated for general usage inside another large software. It also meant the possibility of naming conflicts, the two softwares fighting over output buffering, and many other problems. Even past that, there have been licensing problems.

[...]
Title: Including Log in as Welcome?
Post by: sirdavid23 on March 16, 2005, 01:41:29 PM
Hi, I´d like to do this:



But I can´t figure out the coding part. I try to work it on this web page.
http://www.turismopeninsular.com

But I can´t.  I´ve been working with the ssi.php samples but I only need the login box exactly as there is in that graphic. How could I do this?

Help me please.
Title: Re: Basic SSI FAQ
Post by: Elissen on March 16, 2005, 02:30:35 PM
Quote from: sirdavid23 on March 16, 2005, 01:41:29 PM
Hi, I´d like to do this:



But I can´t figure out the coding part. I try to work it on this web page.
http://www.turismopeninsular.com

But I can´t.  I´ve been working with the ssi.php samples but I only need the login box exactly as there is in that graphic. How could I do this?

Help me please.

I get "Error 404 page. Change it on /errors/404.html Add more on the .htaccess file" when accesing the picture
Title: Re: Basic SSI FAQ
Post by: Cypher7 on March 16, 2005, 04:11:57 PM
did you mean this... ;)

http://www.davidr.boxesmedia.com/allpics/foro.jpg

Are you sure you put in   <?php require("SSI.php"); ?>   on the page!?  It should go in BEFORE the <html> tag...

then put in this tag on your page where ever you want the login box to be...

<?php ssi_login(); ?>

Title: Re: Basic SSI FAQ
Post by: sirdavid23 on March 23, 2005, 08:06:35 PM
Wel... yes, It´s working now. Now that I included the index.PHP part. I had it working as index.htm.

On to the next question:
Could I manipulate the ssi login function so that It would display in arial 9 points:

USR___________
PSW___________  O <- button made in flash that says: YES! to log in.

Is this possible? even a GIF pic will do. But how do I work this?
Title: Re: Basic SSI FAQ
Post by: [Unknown] on March 23, 2005, 08:33:34 PM
Yes, just use the .ssi_table css class....

http://www.w3schools.com/css/

-[Unknown]
Title: Re: Basic SSI FAQ
Post by: cellDamage on April 16, 2005, 06:36:50 AM
If you 'is_guest' etc.

How can you find out if the user is a global mod?
Probably easy as hell but i wanna ask :)
Title: Re: Basic SSI FAQ
Post by: Owdy on April 16, 2005, 06:45:28 AM
I use this:

<?php


if (in_array(2$user_info['groups']) || $context['user']['is_admin'])
   {
       echo 
'Hello moderator!      ';
   }
else
   {
       echo 
'You dont have permission to be here!.';
   }

?>
Change that '2' to moderators membergroup id. This allows them and admin.
Title: Re: Basic SSI FAQ
Post by: cellDamage on April 16, 2005, 06:55:09 AM
Thank you Owdy, this place rocks :D

Just completely incorporated SMF into my website & my gallery, its just so much easier than my original user system, thanks for creating such great software :D

My gallery is even better now!  ;D

SO if to edit my global mods group i use this:
http://ftmb.net/forum/index.php?action=membergroups;sa=edit;id=2

then the id is 2? :)
Title: Re: Basic SSI FAQ
Post by: Owdy on April 16, 2005, 06:57:54 AM
Yes, that should be it.
Title: Re: Basic SSI FAQ
Post by: cellDamage on April 16, 2005, 08:01:23 AM
Worked like a dream  :D

Thankyou so much.
Title: Re: Basic SSI FAQ
Post by: AnimeHungry.com on May 15, 2005, 09:25:08 AM
how do i make a login that once loged in, you get redirected to the homepage????
Title: Re: Basic SSI FAQ
Post by: <--Atlas--> on July 16, 2005, 02:49:05 PM
I heard there is a new API that is not SSI is this true, and where can I find more info on it?
Title: Re: Basic SSI FAQ
Post by: Anguz on July 16, 2005, 09:59:21 PM
You'll find it here:
http://www.simplemachines.org/download.php?converters
Title: Re: Basic SSI FAQ
Post by: vizcares on July 17, 2005, 06:09:57 PM
Hi

if I want to insert the latest post in a html page can I use SSI or has it to be on a php page?

Maybe it's a supid question, but I have no clue about php

thanks in advance
Title: Re: Basic SSI FAQ
Post by: Tomer on July 17, 2005, 06:12:21 PM
You can use .shtml, or .php

- TOmer
Title: Re: Basic SSI FAQ
Post by: vizcares on July 17, 2005, 06:15:29 PM
Quote from: Tomer on July 17, 2005, 06:12:21 PM
You can use .shtml, or .php

- TOmer

Ok thanks

I normally use Frontpage and I have a index page called index.htm is there some way I can change this page to .shtml or do I have to make a whole nesw page?
Title: Re: Basic SSI FAQ
Post by: JoeP on September 04, 2005, 06:43:04 PM
 :)This kind of tutorial is EXTREMELY helpful!
Looking forward to the advanced topics!

I hope there's something similar for the events calendar.
joe
Title: Re: Basic SSI FAQ
Post by: Gary on October 04, 2005, 06:59:04 PM
Nevermind, its sorted.  8)
Title: Re: Basic SSI FAQ
Post by: Gwydion Frost on December 18, 2005, 04:23:23 PM
Ok, maybe I'm just not following...and as smart as I like to think I am, it's a little frustrating to be sounding so stupid and not grasping what should be a simple concept.

Following the directions as I have read them:

Create a document with a php extension. Place code within it. Place UNNAMED php document SOMEWHERE RANDOM in your forum directory.

Errr...what do I name this document, and how the heck does the forum software know how to access it?

I have multiple forums.

I have a shared database for these forums, each install has it's own tables, with only a few tables shared, such as...
  shared_log_activity
  shared_log_floodcontrol
  shared_log_karma
  shared_log_online
  shared_log_subscribed
  shared_membergroups
  shared_members
  shared_personal_messages
  shared_pm_recipients
  shared_subscriptions

Now, the issue I have here, is that I am under the understanding that SSI will allow my folks to log in, and bop from board to board to board (I also have the cookies set the same for each board). How do I do so, with SSI, because right now, even with the shared tables and cookies, you still have to log in fresh for each board...and that just won't do!
Title: Re: Basic SSI FAQ
Post by: PSPXavier on December 20, 2005, 08:00:29 PM
I'm quite confused...... I have a html homepage and that's where I want the code to go... So if I put the code in a php file it works, but how do I get it to work on my html page? Here's my current code.

<?php
require("/home/pspzone/public_html/smf/SSI.php"); 
 
ssi_welcome(); ?>
Title: Re: Basic SSI FAQ
Post by: 1MileCrash on December 20, 2005, 09:25:32 PM
change the .html extension to .php.
Title: Re: Basic SSI FAQ
Post by: PSPXavier on December 20, 2005, 09:53:48 PM
But everything else in that page(index.html) is html.........
Title: Re: Basic SSI FAQ
Post by: 1MileCrash on December 20, 2005, 10:09:36 PM
it doesnt matter.


php doesnt even do anything if the code isnt surrounded by <?php ?> tags. it's a server side language. it just outputs html.

Title: Re: Basic SSI FAQ
Post by: PSPXavier on December 20, 2005, 10:21:01 PM
Okay-- so you have to have it .php, gotcha.

Is there a shtml version of this FAQ?
Title: Re: Basic SSI FAQ
Post by: psychophat on January 14, 2006, 04:36:18 PM
Hi,

Got lost again in the vast forum, heheheh . . . I also wanted to know how to CSS this:

Output page                    CSS file
Board  Topics Posts  =    .ssi_table
test1    1        1        =     ? what .ssi are these?
test2    1        2

<th height="300" scope="row" class="ssi_tables"><?php ssi_topBoards(); ?></th>

What is the code for this one, err I mean the .ssi_??? for this part. But when you use .ssi_table it'll only change the table not the lower half where would I change this and how to I code this for these are two types, right?



Thank you


-Patrick Grey
Title: Re: Basic SSI FAQ
Post by: Acf on January 27, 2006, 09:00:44 AM
Tomer shouldn't your welcome.txt be:

<?php
require("/your/path/to/SSI.php"); 

// Script writen by Tomer "Lamper" Dean.
// **NOTE** Always check that the require statement is correct!
// A script that puts the persons membergroup into a variable for later use.

// Puts every person into a group.

if ($context['allow_admin'])
   {
      
$MemberGroup "Admin";
   }
elseif (
$context['user']['is_guest'])
   {
      
$MemberGroup "Guest";
   }
else
   {
      
      
$MemberGroup "User";
   }

// Echo's the membergroup of the person.

echo 
'<center><h5>Welcome $MemberGroup!</h5></center>';

?>



otherwise a user is guest and a geust is user...
Title: Re: Basic SSI FAQ
Post by: fluid on February 10, 2006, 01:06:47 PM
i would like to do something that another user here mentioned as well. i am building a site from the ground up without using a CMS. i have SMF installed that is being used, and would like to take the main page from the site and use SSI to handle logins and authentication. my problem with doing it with ssi_login(); is that the form posts to the root page of the forums. is there any way to have ssi_login(); post back to the root page of the site itself, and not take you into the forums?

everything is working flawlessly so far...i just need to get this one thing sorted out :D
Title: Re: Basic SSI FAQ
Post by: willtaka on February 16, 2006, 03:05:15 PM
Is there anyway of adding an actual board into ssi :D
Title: Re: Basic SSI FAQ
Post by: Gruss on February 25, 2006, 11:37:11 AM
Quote from: GiNi3D on December 09, 2004, 11:49:51 PM
@bunkfilms
Did you try your domain name>>  <?php include ('http://www.yourDomainName.com/forums/SSI.php'); ?>


For some reason I can't get the login to pass the credentials. I'm running SMF 1.06 and PHP 4.4.1.

If I use:

require('http://www.mydomain.com/myforum/SSI.php');

it works, but I get this:

QuotePlease don't access SSI.php by URL directly; you may want to use the path ('SSI.php') or add ?ssi_function=something.




if I use the correct path

require('/home/#####/public_html/myforum/SSI.php');

where ##### is my account

or

require('SSI.php')

since the login.php is in the same directory as SSI.php

it doesn't pass the credentials.




My whole code below

Thanks in advance for any assistance.  If I find anything out I'll edit my post and put below.

Gruss




<?php
require('/home/#####/public_html/myforum/SSI.php');

global 
$context;

if (
$context['user']['is_guest'])
{
 echo
 
'<h5>Access Denied</h5>
 We are sorry guest, it seems you dont have premission to view these downloads.'
;
}
else
{
 echo
 
'<h5>Welcome '$context['user']['name'], '!</h5>
 Here are your downloads:'
;
}
?>

Title: Re: Basic SSI FAQ
Post by: FiberOptix on March 25, 2006, 04:07:38 PM
what do you have to when you said open a text file and save it with a extension of .php and then open it and put that code in it then what do you do. im trying to get it so that if you login your logged in on the forums. I dont get it can someone explain in full?
Title: Re: Basic SSI FAQ
Post by: ReD^DeviL on July 17, 2006, 04:17:44 PM
Ok, Someone needsto help me. I took the code from the welcome file from the first post, and put it in my php file at the very top, and I still can't see nothing.

<?php
require("/www/home/goalforums.net/forums/SSI.php"); 

// Script writen by Tomer "Lamper" Dean.
// **NOTE** Always check that the require statement is correct!
// A script that checks if your a guest, and if guest, puts a login box,
// and if user, put a welcome message.

// Checks which membergroup you are in.

if ($context['user']['is_guest'])
   {
      
ssi_login();
   }
else
   {
      
ssi_welcome();
   }

?>


Am I missing something? please help a PHP retard XD
Title: Re: Basic SSI FAQ
Post by: Ravyn on August 26, 2006, 12:16:44 AM
Hi there,

I just started messing around with Server Side Includes, and found this tutorial.  I've got the ssi_menubar working, sort of, it displays all the proper links for the menubar, however it only displays the text versions, how do I get it to display the graphic interface that is used on the forums when visiting my homepage?

Edit: I got it working properly by looking at the code for the ssi_example.php file.  However, I was hoping someone could just give me a quick breakdown of what each part of the code I added to make it work does.

The part between the <body> tags being the addition that made it work.

<?php

require("/home/virtual/site45/fst/var/www/html/forums/SSI.php");
ssi_menubar();
?>

<html>
<body>
<?php

echo 
'
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/style.css" />
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js"></script>
<style type="text/css">
body
{
margin: 1ex;
}'
;

if ($context['browser']['needs_size_fix'])
echo '
@import('
$settings['default_theme_url'], '/fonts-compat.css);';

echo '
</style>'
;

?>

</body>
</html>
Title: Re: Basic SSI FAQ
Post by: pctwo on August 26, 2006, 05:57:01 PM
Is there a variable and function which returns the full URL of the current file.

I have to do something like

$_SERVER['SCRIPT_NAME'] or $_SERVER['REQUEST_URI'] only returns /path/file.php.  I need the full http://www.mysite.com/path/file.php for ssi_login and ssi_logout to redirect to the proper place.

I guess I could reconstruct it with server_protocol and name and port but that's kinda ugly, and I'll probably get it wrong too :)

(I don't want to hard code it either b/c it needs to work both on my test machine and real server)

thanks
Title: Re: Basic SSI FAQ
Post by: pctwo on August 26, 2006, 08:13:28 PM
Quote from: ReD^DeviL on July 17, 2006, 04:17:44 PM
Ok, Someone needsto help me. I took the code from the welcome file from the first post, and put it in my php file at the very top, and I still can't see nothing.

<?php
require("/www/home/goalforums.net/forums/SSI.php"); 

// Script writen by Tomer "Lamper" Dean.
// **NOTE** Always check that the require statement is correct!
// A script that checks if your a guest, and if guest, puts a login box,
// and if user, put a welcome message.

// Checks which membergroup you are in.

if ($context['user']['is_guest'])
   {
      
ssi_login();
   }
else
   {
      
ssi_welcome();
   }

?>


Am I missing something? please help a PHP retard XD

Where in your file did you insert this?

If you insert it at the top, above <html>, that may be why it doesn't show up.

You need to put the require statement at the top.  The rest goes inside the <body></body> tag.


<?php
require("/www/home/goalforums.net/forums/SSI.php"); 
?>

<html>
<body>
....
if ($context['user']['is_guest'])
   {
      ssi_login();
   }
else
   {
      ssi_welcome();
   }

?>
</body>
</html>
Title: Re: Basic SSI FAQ
Post by: pctwo on August 26, 2006, 08:24:21 PM
Quote from: fluid on February 10, 2006, 01:06:47 PM
i would like to do something that another user here mentioned as well. i am building a site from the ground up without using a CMS. i have SMF installed that is being used, and would like to take the main page from the site and use SSI to handle logins and authentication. my problem with doing it with ssi_login(); is that the form posts to the root page of the forums. is there any way to have ssi_login(); post back to the root page of the site itself, and not take you into the forums?

everything is working flawlessly so far...i just need to get this one thing sorted out :D

you need to pass ssi_login the full url of the page you ant to redirect to

ssi_login('http://www.123.com/path/file.php') it will then redirect to the page

I ended up writing a function called ssi_thisurl() that returns the url of the current page


function ssi_thisurl()
{
return
  (preg_match("/^https/i", $_SERVER['SERVER_PROTOCOL']) ? 'https' : 'http') . '://' . $_SERVER['SERVER_NAME'] .
  ($_SERVER['SERVER_PORT']==80 ? '' : ':' . $_SERVER['SERVER_PORT']) .
  $_SERVER['SCRIPT_NAME'];
}


and I can now just use ssi_login(ssi_thisurl()) and it redirects right back to the page the user was at.

This way, it works for all pages and you can include this anywhere.

note: this code is hacky and not what the doctor recommends!
Title: Re: Basic SSI FAQ
Post by: gregy on September 05, 2006, 07:03:27 AM
hi

is it possible to use SSI.php on other domain ..?

like, forum is on 123.com and i want to be able to use SSI.php as infobox on domain 345.com ..

thanx in advance
Title: Re: Basic SSI FAQ
Post by: pctwo on September 05, 2006, 09:43:21 AM
Quote from: gregy on September 05, 2006, 07:03:27 AM
hi

is it possible to use SSI.php on other domain ..?

like, forum is on 123.com and i want to be able to use SSI.php as infobox on domain 345.com ..

thanx in advance

I think you'd need to install smf on 345.com and point it to 123.com, e.g., Setting.php looks something like this


<?php
########## Forum Info ##########
$boardurl 'http://www.123.com/smf'; # URL to your forum's folder. (without the trailing /!)
########## Database Info ##########
$db_server 'db.123.com';
$db_name 'mysmfforum';
$db_user 'mysmfuser';
$db_passwd 'mypasswd';


########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
$boarddir '/home/user/www/smf'; # These would have to be path on 345.com
$sourcedir '/home/user/www/smf/Sources'; # Path to the Sources directory.

?>



this is assuming your host allows mysql connection from outside domain.  If yes, you can usually specify and acces list and you just add 345.com to the list.
Title: Re: Basic SSI FAQ
Post by: gregy on September 05, 2006, 09:57:17 AM
hi

thanx for help .. i did another trick ( i was having probelms with SSI into Oscommerce .. i managed with hand made file .. include :)

no, i have another question ... can i use SSI.php recent posts from specific category or Board? (cat=11 or boards 113,114,115,116)
Title: Re: Basic SSI FAQ
Post by: pctwo on September 05, 2006, 11:08:45 AM
Quote from: gregy on September 05, 2006, 09:57:17 AM
hi

thanx for help .. i did another trick ( i was having probelms with SSI into Oscommerce .. i managed with hand made file .. include :)

no, i have another question ... can i use SSI.php recent posts from specific category or Board? (cat=11 or boards 113,114,115,116)

for boards, it's easy b/c the function already lets you EXCLUDE board, so one small change should do it.  For example, in ssi_recentPosts() change

         AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "

to

         AND b.ID_BOARD IN (" . implode(', ', $exclude_boards) . ")") . "

i.e., take out the NOT.  It's best to make a copy that function and call it something else, like ssi_myRecentPosts. You may want to change the variable name $exclude_boards to $include_boards so it's not confusing.  Then you just call it like this

ssi_myRecentPosts( 10, array( 110,114,120))

(get 10 most recent posts from boards 110, 114, and 120)
Title: Re: Basic SSI FAQ
Post by: gregy on September 05, 2006, 11:27:29 AM
thank you very much for these lines .. so if i understood right

<?php include("http://www.domain.com/SSI.php?ssi_function=recentPosts( 10, array( 113,114,115,116))"); ?>

will show last 10 posts from these boards? guess not .. it's not working :(
Title: Re: Basic SSI FAQ
Post by: pctwo on September 05, 2006, 12:04:26 PM
define "not working"?
Title: Re: Basic SSI FAQ
Post by: gregy on September 05, 2006, 12:34:42 PM
i have deleted NOT in two instances in SSI.php and made include like statedin prevoius my post, now, no posts show up  :-[
Title: Re: Basic SSI FAQ
Post by: pctwo on September 05, 2006, 02:39:48 PM
do you get anything if you put NOT back in?

Is that include statement correct? Try the function call without any arguments.
Title: Re: Basic SSI FAQ
Post by: gregy on September 06, 2006, 02:28:03 AM
function recentposts works great without thoe yours modifications .. or i'm doing something wrong .. i'll check that again ...
Title: Re: Basic SSI FAQ
Post by: pctwo on September 06, 2006, 01:42:23 PM
try doing it the way ssi_exaples.php does, like this


<?php require('/absolute_local_path_to_your_smf/SSI.php'); ?>

<?php ssi_recentPosts(10,array(110,115)); flush(); ?>


the first line should go on top of the page.  2nd line goes where you want to insert the output.
Title: Re: Basic SSI FAQ
Post by: gregy on September 06, 2006, 03:45:11 PM
hmm .. but this "require" would stop my site loading if other domain won't be available!?
Title: Re: Basic SSI FAQ
Post by: pctwo on September 06, 2006, 04:54:07 PM
I don't know.

when you do it your way, do you get an error msg? anything?
Title: Re: Basic SSI FAQ
Post by: gregy on September 07, 2006, 02:08:47 AM
it works  ;)

OK .. here is what i did .. of course with big help of you pctwo  ;D

.. for noobies like me

My forum resides at original.com in root .. my wish was to pull out recent posts and show them on another domain on another server, at otherdomain.com.

I created a file called recent.php and put it on otherdomain.com and in this file i calles all SSI that i needed, now my recent .php on otherdomain.com looks like this

Quote<html>
<head>
</head>
<body>
<?php require('/home/web/original.com/www/SSI.php'); ?>
<font face="verdana" size="1"><?php ssi_recentPosts(10,array(113,114,115,116)); flush(); ?></font><br>
<?php include("http://www.original.com/SSI.php?ssi_function=boardStats"); ?>,&nbsp; Online: <?php include("http://www.original.com/SSI.php?ssi_function=logOnline"); ?>
</body>
</html>

i had to make it in special file, cause Oscommerce somehow is not allowing to call into those files .. dunno why .. but this way it works very well!

thanx a gain for supoort
Title: Re: Basic SSI FAQ
Post by: pctwo on September 07, 2006, 10:07:11 AM
I think that works because your original and other domains are both hosted on the same machine, right?

See, I don't know what I'm talking about and together we lucked into the right answer :)

For the poor unsuspecting soul who tumbles on this topic, here's (I think) the correct way to do this:

Because we can't pass function parameters via the URL, we need to define a function that does it for us.  In the original.com's SSI.php, add a function like this


function ssi_myRecentPosts()
{
     ssi_recentPosts( 10, array(100,120,140)); // or whatever parameters you need
}


If you don't know where to put this, insert it at the end at the line before the ?>

Then call it like you did with the other functions

<?php include("http://www.original.com/SSI.php?ssi_function=myRecentPosts"); ?>

Get rid of the line <?php require ... ?>

.
Title: Re: Basic SSI FAQ
Post by: sastian on October 03, 2006, 10:25:45 PM
am i having the same issue with SMO Shoutbox?
my log is full of ...
QuoteApply Filter: Only show the error messages of this member  XXXX       Today at 09:54:51 PM
Apply Filter: Only show the error messages of this IP address XXXX      Apply Filter: Only show the error messages of this session XXXX
Apply Filter: Only show the error messages of this URL http://XXXX.com/index.php?option=com_smf&amp;Itemid=52&amp;option=com_smf&amp;amp;Itemid=52&amp;amp;action=viewErrorLog;desc
Apply Filter: Only show the errors with the same message
8: Undefined variable: context
File: /home/XXXX/public_html/modules/mod_smo_ajax_shoutbox.php
Line: 456
   
Apply Filter: Only show the error messages of this member XXXX    Today at 09:54:51 PM
Apply Filter: Only show the error messages of this IP address XXXX      Apply Filter: Only show the error messages of this session XXXX
Apply Filter: Only show the error messages of this URL http://XXXX.com/index.php?option=com_smf&amp;Itemid=52&amp;option=com_smf&amp;amp;Itemid=52&amp;amp;action=viewErrorLog;desc
Apply Filter: Only show the errors with the same message
8: Undefined variable: context
File: /home/XXXX/public_html/modules/mod_smo_ajax_shoutbox.php
Line: 455


array(
'tag' => 'glow',
'type' => 'unparsed_commas',
'test' => '[#0-9a-z\-]{3,12},([012]\d{1,2}|\d{1,2})(,[^]]+)?\]',
'before' => $context['browser']['is_ie'] ? '<table border="0" cellpadding="0" cellspacing="0" style="display: inline; vertical-align: middle; font: inherit;"><tr><td style="filter: Glow(color=$1, strength=$2); font: inherit;">' : '<span style="background-color: $1;">',
'after' => $context['browser']['is_ie'] ? '</td></tr></table> ' : '</span>',
),
Title: Re: Basic SSI FAQ
Post by: abney317 on October 09, 2006, 08:34:13 PM
how do I import the forum news??
Title: Re: Basic SSI FAQ
Post by: codenaught on October 09, 2006, 08:56:18 PM
Quote from: abney317 on October 09, 2006, 08:34:13 PM
how do I import the forum news??
Can you be more specific?

There are two news functions.

ssi_boardNews(ID_BOARD) shows the posts made in the defined board.
ssi_news() outputs your forum news from Admin / News and Newsletters
Title: Re: Basic SSI FAQ
Post by: abney317 on October 09, 2006, 09:10:09 PM
I just need a full out code/tutorial on how to have simple machine's forum (MY FORUMS) news on a page of my site

help??
Title: Re: Basic SSI FAQ
Post by: Gary on October 09, 2006, 09:26:38 PM
Yeah, but which  news function. Please be specific to what you need.

ssi_boardNews(ID_BOARD) allows you make a thread work as an update to your site.
ssi_news() gives you the News from the News & Newsletters section of your admin center.

-AwwLilMaggie
Title: Re: Basic SSI FAQ
Post by: abney317 on October 09, 2006, 09:33:29 PM
ssi_boardNews(ID_BOARD) allows you make a thread work as an update to your site.

I guess this... because I want the NEWS TOPICS... on the homepage  :)
Title: Re: Basic SSI FAQ
Post by: abney317 on October 10, 2006, 10:09:34 PM
help soon please  ;D
Title: Getting User's Mail Outside of SMF
Post by: sectit on October 12, 2006, 01:17:39 PM
HElo ,

How can i get user's mail outside of smf forum ? is there any variable or array  like $context['user'][..mail or email etc ??...']
Title: Re: Basic SSI FAQ
Post by: Murray on December 28, 2006, 07:28:50 PM
Cheers Lamper, exactly what i was looking for!
Title: Re: Basic SSI FAQ
Post by: MothMan on January 24, 2007, 01:06:58 PM
Hi all.

I need some help with basic ssi...

All I'm trying to do is bring in my forum menu bar into another page, and I'm obviously doing something wrong.

To test it out I've created a super-basic php page ....

Just a table with a logo in the top row, and the menubar in the row below.

What I'm getting is this:

http://www.othersi.com/rss/test.php (http://www.othersi.com/rss/test.php)

It's bringing in the links, but not the menu-bar itself.

The code for this test page is:


<?php require("/**path as indicated in ssi_examples**/SSI.php"); ?>

<html>

<body>

<table>
<tr>
<td>
<img src="http://othersi.com/Themes/default/images/silogo.jpg">
</td>
</tr>
<tr>
<td>
<?php ssi_menubar(); ?>
</td>
</tr>
</table>

</body>
</html>


What am I missing?
Title: Re: Basic SSI FAQ
Post by: MothMan on January 24, 2007, 09:37:30 PM
Update:

I found related info earlier in this thread about an identical problem...  as per this post:

http://www.simplemachines.org/community/index.php?topic=12936.msg699237#msg699237

I added


<?php

echo 
'
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/style.css" />
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js"></script>
<style type="text/css">
body
{
margin: 1ex;
}'
;

if ($context['browser']['needs_size_fix'])
echo '
@import('
$settings['default_theme_url'], '/fonts-compat.css);';

echo '
</style>'
;

?>



between the body tags.

The menu now appears properly in my pages.

But... on one of the pages, the menu shows as though I am logged out.

I've added the same ssi coding to 3 different pages, and on 2 of them it works properly... on the other (http://www.othersi.com/rss/sirssnews.php (http://www.othersi.com/rss/sirssnews.php)) it always shows as though I'm logged out.

I think it's due to the way the page is working... as this page is actually the RSS2HTML script (http://www.rss2html.com/) , edited and renamed to parse an rss feed via a template php file (that template file being http://www.othersi.com/rss/rss_newspage_template.php (http://www.othersi.com/rss/rss_newspage_template.php))

I've set the ssi code in the rss_newspage_template.php file, as that is the file that is actually displaying the page content. On an off-chance, I also put the ssi "require" statement in the sirssnews.php file, but it didn't make a difference.

Interestingly, if you browse to the template file (click the link above to rss_newspage_template.php), the menu bar appears properly, showing the user as being logged in.

But because that is just the template file, it doesn't actually display the RSS content... to do that, you have to get to the template "through" the script page (sirssnews.php)


I imagine this sounds very confusing lol, but any assistance would be appreciated... any further info required of me to help troubleshoot, please let me know.
Title: Re: Basic SSI FAQ
Post by: MothMan on February 02, 2007, 01:38:04 PM
Any ideas?

You can see for yourself what is happening, here:

http://www.othersi.com

You can login as :
u: testuser
p: testuser

From the front page, if you go to the forum, or to the contact page (contact link is on the top menu), you'll see the SMF menu header works fine... although, I did just notice that the FORUM link disapperas while in the contact page.... so that's not right.

But, if, from the front page, you go to the News page (link is in the left-side navigation block), the SMF menu header doesn't work right... it always shows as if you are logged out.   And, again, the FORUM link is missing.
Title: Re: Basic SSI FAQ
Post by: gregy on February 06, 2007, 05:34:54 AM
Hi

After upgrading my SSi is not working as it should :)

this code

Quote
<?php require('/home/web/domain.com/www/SSI.php'); ?>
<table border="0">
   <tr>
      <td><?php ssi_recentPosts(10,array(113,114,115,116,13)); flush(); ?></td>
</tr>
<tr>
      <td valign="bottom"><?php include("http://www.domain.com/SSI.php?ssi_function=boardStats"); ?> <br>Trenutno online: <?php include("http://www.domain.com/SSI.php?ssi_function=logOnline"); ?></font></td>
   </tr>
</table>

this code should pull out only boards 113 114 115 116 13 .. but it displays new posts in all boards ..

any idea why?

In previous version this code worked like a charm ..

P.s. this code is called on other domain as SMF installed is ...
Title: Re: Basic SSI FAQ
Post by: gregy on February 07, 2007, 12:12:27 PM
hmm .. i just found out that code

<?php ssi_recentPosts(10,array(113,114,115,116,13)); flush(); ?>

is EXCLUDING these boards .. not including only these ...

but this is happening now after upgrade  :o
Title: Re: Basic SSI FAQ
Post by: hygron on February 13, 2007, 09:01:37 AM
would this work for say, permissions on category/s. in regards to only allowing a certain user group to see one private category in the smfgallery, while allowing all the other member groups to see all, but the private category?

i.e.  I set up 5 categories for images...I would like one of the categories to be private...only viewable to a private member group.  Am I correct in thinking I can do something like this

<?php
require("YOUR_PATH_TO_SSI.php"); 

if (
$context['user']['is_all other member groups except private'])
 {
   echo 
   
'<h5>Access Denied</h5>
   We are sorry all other member groups except private, it seems you don'
t have permission to view this category.';
 }
else
 {
   echo
   '
<h5>Welcome ', $context['user']['name'], '!</h5>
   
Here is your private category:';
 }
?>



This is the 1st time I have even tried anything involving SSI_but your tutorial made it seem pretty simple.  Can this work, or did I misunderstand the article?  Thanks H
Title: Re: Basic SSI FAQ
Post by: MothMan on February 14, 2007, 05:25:11 PM
Quote from: MothMan on February 02, 2007, 01:38:04 PM
Any ideas?

You can see for yourself what is happening, here:

http://www.othersi.com

You can login as :
u: testuser
p: testuser

From the front page, if you go to the forum, or to the contact page (contact link is on the top menu), you'll see the SMF menu header works fine... although, I did just notice that the FORUM link disapperas while in the contact page.... so that's not right.

But, if, from the front page, you go to the News page (link is in the left-side navigation block), the SMF menu header doesn't work right... it always shows as if you are logged out.   And, again, the FORUM link is missing.

Final plea for help on this one. :p  Anyone?

Edit:  Sadness. :(
Title: Access the SSI with URLs
Post by: Lastwebpage on March 08, 2007, 07:02:01 AM
I am not sure about the using of "direct" URLs, for example:
OK:
http://forum.miranda-im.de/SSI.php?ssi_function=boardNews;board=2;limit=2;length=30
Wrong:
http://forum.miranda-im.de/SSI.php?ssi_function=recentPosts;num_recent=5
http://forum.miranda-im.de/SSI.php?ssi_function=topBoards;num_top=5

I see no really differents in the function calls, but in the first link the numbers works, in the other two examples not. What are the differents? If the _ is the problem, why it was used?

(Before someone ask, no I can't access my forum with PHP)
Title: Re: Basic SSI FAQ
Post by: HRM on March 26, 2007, 05:33:46 AM
I have a little problem that I didn't notice before since my last update.
My ssi_examples page remains totally blank.

http://www.muziek4um.nl/ssi_examples.php

ssi.php is just working as all the functions do work. It just the examples page that doesn 't sho up.
Any idea??

If mentioned before somewhere else please warn me as I've not been around for a while.

Thanks in advance.

Ed.
Title: Re: Basic SSI FAQ
Post by: romeoyankee on May 19, 2007, 11:09:49 AM
hey guys.. just wondering if anybody knows about the php include function?  The posts in this topic all have to do with starting a brand new index page and naming it index.php

What I have done is this..

I have created little php files on my server.. something like this.

name: login.php

code:

<?php
require("SSI.php");

if ($context['user']['is_guest'])
   {
      ssi_login('http://www.domain.com');
   }
else
   {
      ssi_logout('http://www.domain.com');
   }

?>


After making that, I have a php file on my server called login.php with the login script.  if you go to www.domain.com/smf/login.php you will see that it works and that it functions normally.  now what I do is this.  I go back to my index.html file and use this function

<?php include("http://www.domain.com/smf/login.php"); ?>

and stick that little bit of code wherever i want the login box to appear on the page.  You can put it in a table.. just on the page wherever.. you can format it.. you can do whatever you want.

when you then go to www.domain.com/index.html  the login box will get included on the main page.

Title: Re: Basic SSI FAQ
Post by: jonidfld on June 24, 2007, 07:29:19 AM
This is actually realy frustrating.

I can't get this to work and you all seem to think it's most straight forward thing ever.

I've followed all variations of instructions in this post with no effect whatsoever.

I have the path correct at the top of my page etc.... can anyone actual write out what to do 'exactly' in point to point simple terms?

Please. I've geiven my self square eyes this morning tryin ti get this to work.
Title: Re: Basic SSI FAQ
Post by: spottedhog on June 24, 2007, 08:42:53 AM
jonidfld,

My guess here is that your issue is probably with the "Path" to the SSI.php file. Look in your Settings.php file at the $boarddir. This is your "Path". Your "Path" is NOT something like: http://www.yourdomain.com

Your "Path" should look something like this: /home/accountname/www/ or something similar.

To place a ssi function, in a php extention file:

ssi_welcome();

Please note that this is NOT put into an echo statement. In other words, this is WRONG:

echo 'ssi_welcome();'; <-----VERY WRONG AND WILL NOT WORK!

To place a ssi function in a html extention file:

<? ssi_welcome(); ?>
Title: Re: Basic SSI FAQ
Post by: jonidfld on June 24, 2007, 09:26:25 AM
Yeah i do have the correct path.

But ill change the other to see - ill let you know! Thanks for your reply!  ;D
Title: Re: Basic SSI FAQ
Post by: jonidfld on June 24, 2007, 09:38:25 AM
Ok no joy.

Im using this as my path to SSI at the very top of the page....

<?php require("D:\hshome\accountname\website.com\forum\SSI.php"); 
?>


Then inputing...

<?php ssi_recentTopics(); ?>

or

ssi_welcome();


but neither work.

Hmmmmm.  ::)

i am using a CMS system would that annoy it?  :-[
Title: Re: Basic SSI FAQ
Post by: spottedhog on June 24, 2007, 09:42:43 AM
I am guessing here, but it appears you are using this on your local PC. I am certain your path is wrong, but I am not sure what to do to make it right.

Try this:

require(".\SSI.php");

or something similar

maybe this:

require('SSI.php');


If that does not work, where are you putting the SSI.php? In an html extension file? If so, is SSI.php before the html tag?

If you can see the forum, open the ssi_examples.php file and you will see how to write the require SSI.php

For example:

http://www.yoursite.com/ssi_examples.php

Title: Re: Basic SSI FAQ
Post by: jonidfld on June 24, 2007, 01:24:25 PM
i am sure this is the correct path, as i have used it for other things linked to the forum, such as the gallery & server settings etc.

But im gona try your suggestions now.

Time to play around with it again!!!  :P
Title: Re: Basic SSI FAQ
Post by: jonidfld on June 24, 2007, 01:47:54 PM
 :( no luck, can anyone help?  ::)
Title: Re: Basic SSI FAQ
Post by: spottedhog on June 24, 2007, 03:06:41 PM
You opened the ssi_examples.php file in your browser and it gave you the same path as the one you are using?
Title: Re: Basic SSI FAQ
Post by: jonidfld on June 24, 2007, 03:13:42 PM
Quote from: spottedhog on June 24, 2007, 03:06:41 PM
You opened the ssi_examples.php file in your browser and it gave you the same path as the one you are using?

Exactly yes. The path is fine.
Title: Re: Basic SSI FAQ
Post by: spottedhog on June 24, 2007, 03:26:33 PM
Check this thread:

http://www.simplemachines.org/community/index.php?topic=146803.0 (http://www.simplemachines.org/community/index.php?topic=146803.0)
Title: Re: Basic SSI FAQ
Post by: jonidfld on June 25, 2007, 12:49:56 PM
Quote from: spottedhog on June 24, 2007, 03:26:33 PM
Check this thread:

http://www.simplemachines.org/community/index.php?topic=146803.0 (http://www.simplemachines.org/community/index.php?topic=146803.0)

Not much help. Thanks though.
Title: Re: Basic SSI FAQ
Post by: rch10007 on July 20, 2007, 09:40:29 PM
EDIT - The following problem was resolved by eliminating the FlashChat section in the Subs file.  I'm not sure why yet so I have to figure it out but I guess it's a bug either way...  I guess I'll email the guy who made it to let him know him I had trouble with his Mod.  I think because the install was an integration with SMF, a few tables didn't get made in the DB...

Any ideas about this?

************************************************************
**BEFORE clicking the page, read all the way down first...

Anyone else get this error from my forum?  The URL: http://www.teens4christ.org/forum/ssi_examples.php and the error is:


Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/1.3.33 Server at www.teens4christ.org Port 80


Ok, I also just noticed that I get a gazillion error messages on the forum after trying to access that page.  Here is the error messages repeated over and over:


Database Error: No Database Selected
File: /path/to/forum/Sources/Subs.php
Line: 3379


...and here is that query in the Subs.php file:


$result = db_query("
SELECT
fc.userid, fc.state, fc.color, fc.lang, fc.roomid,
fr.name AS roomName, fr.ispublic,
mem.realName, mem.memberName, mem.showOnline, mg.onlineColor,
mg.ID_GROUP, mg.groupName
FROM {$GLOBALS['fc_config']['db']['pref']}connections AS fc
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = fc.userid)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
LEFT JOIN {$GLOBALS['fc_config']['db']['pref']}rooms AS fr ON (fc.roomid = fr.id)
WHERE fc.userid IS NOT NULL
AND mem.ID_MEMBER != 0
ORDER BY mem.realName ASC", __FILE__, __LINE__);


Now, I just realized that this query is in the FlashChat integration section of this file!  Why would I get these errors from trying to access the ssi_examples file???
Title: Re: Basic SSI FAQ
Post by: evulness on July 26, 2007, 12:13:55 PM
this should be working....

<?php
require("smf/SSI.php");
if (
$context['user']['is_guest'])
   {
      echo 
' You are not logged in!';
   }
else
   {
      echo
      
'<h5>Welcome '$context['user']['name'], '!</h5>';
   }
?>



it shows the Welcome, and the ! but not the users name...
aka me, logged in on my admin account for the smf

i dont understand whats wrong? it should be showing "Welcome <username>!" right?

EDIT: let me elaborate... i have SMF installed in a folder called "smf" in my root directory my page files aka index.php are in the root folder...
this should work... no?
Title: Re: Basic SSI FAQ
Post by: spottedhog on July 26, 2007, 05:17:39 PM
just below the "require" put: 

global $context;


then it will work ....  sorry about that
Title: Re: Basic SSI FAQ
Post by: dhimes on July 29, 2007, 10:13:56 AM
It appears that $context and $user_info are not global across directories-- even when using
require_once(<path>/SSI.php)
global $context, $user_info;

The symptoms of this are that a user can log in, but when going to another page see, "welcome, guest."  This happens on SMF's very webpages, also.


I also had to add $user_info to the global line in SSI.php (essentially line 193 in SMF 1.1.3).  However, it still doesn't recognize that I am logged in when I go across directories.  I think this is the problem lots of people are having.  Quick fix:  put all of your pages in the same directory as SSI.php.  More elaborate/universal fix?  I may need help.

I will attempt to draw the directory structure so the experts can see:

                                    web root
                                    /             
                                   /               
                                product       
                                    |
                                    |
                                product version
                                    |                    \
                                    |                      \
                                 forum                 other pages
                              <SSI.php>             <landingPage.php>


I want registered users to have access to "landingPage.php"
SMF (and SSI.php) is in the 'forum' directory.  But:  when a user logs in to
SMF, then loads "landingPage.php", he/she is not seen as logged in, but
is seen as a guest.


The 'global' command is not working.

As I mentioned, this is also happening on SMF's webpages.  When I come across it again, I'll post it.  It definitely happens when going to "docs.simpl...', but I think this is by design.
Title: Re: Basic SSI FAQ
Post by: spottedhog on July 29, 2007, 10:36:35 AM
I was having similar problems and recently started using this:

require($_SERVER['DOCUMENT_ROOT'].'/SSI.php'); //add directory if SSI.php is outside Root domain

Now at least I know the path to SSI.php is correct.
Title: Re: Basic SSI FAQ
Post by: dhimes on July 29, 2007, 10:54:34 AM
OK--I'll try it.  Also, this works:

                     forum
                       |
                       |
                    otherPages

That is, using SSI in subdirs works, just not "above."  Even $GLOBAL doesn't save me. 

I'm thinking I could save the username in the session table, then just query for the permissions when people get to the page.  Does that sound sensible?  Seems like using a cannon to hunt a sparrow...
Title: Re: Basic SSI FAQ
Post by: spottedhog on July 29, 2007, 11:47:27 AM
I have tested that line of code on a page 10 directories deep/up and it works fine.
Title: Re: Basic SSI FAQ
Post by: dhimes on July 29, 2007, 02:15:48 PM
Nope--doesn't work for me.  Neither 'require' nor 'require_once' do it.  I am doing this on a windows XP local host, but my public environment will be unix.  Maybe the OS has something to do with it.  I am using SSI to protect pages (check access--I wrote my own routine in SSI.php).  It works in dirs <forum> or below, but not above.  Thanks for your help, anyway.
Title: Re: Basic SSI FAQ
Post by: xyxis_fahim on July 30, 2007, 10:28:02 PM
I'm very new to this interesting feature.
Everything works & ssi shows up great. But how can you move around the functions? Such as from the very top of the board to bottom of the forum?

And help will be much appreciated :)
Title: Re: Basic SSI FAQ
Post by: Joshua Dickerson on July 31, 2007, 05:13:33 AM
Please start a new topic for SSI questions.