(Created page with "==Expert SSI FAQ== Hello and welcome to the Expert SSI FAQ, in this FAQ you will learn expert stuff with SSI, this FAQ is written assuming you have already read the '[[SSI_FAQ_B...") |
Flavio93Zena (talk | contribs) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Expert SSI FAQ== | ==Expert SSI FAQ== | ||
Hello and welcome to the Expert SSI FAQ, in this FAQ you will learn expert stuff with SSI, this FAQ is written assuming you have already read the '[[SSI_FAQ_Basic|Basic SSI FAQ]]' and '[[SSI_FAQ_Advanced|Advanced SSI FAQ]]'. This FAQ has commonly asked SSI questions as well as tips and tricks | Hello and welcome to the Expert SSI FAQ, in this FAQ you will learn expert stuff with SSI, this FAQ is written assuming you have already read the '[[SSI_FAQ_Basic|Basic SSI FAQ]]' and '[[SSI_FAQ_Advanced|Advanced SSI FAQ]]'. This FAQ has commonly asked SSI questions as well as some tips and tricks. | ||
'''**PLEASE DO NOT EDIT YOUR 'SSI.PHP' FILE** | '''**PLEASE DO NOT EDIT YOUR 'SSI.PHP' FILE**''' | ||
Everything done here is done without having to edit 'SSI.php | |||
Everything done here is done without having to edit 'SSI.php' | |||
===How can I check if a user is part of a special membergroup?=== | ===How can I check if a user is part of a special membergroup?=== | ||
We have already learned how to tell if a person is a guest, user or admin, but now we can also check if a user is part of a special | We have already learned how to tell if a person is a guest, user or admin, but now we can also check if a user is part of a special membergroup, lets take an example to help us out: | ||
'''Example''': | '''Example''': | ||
Line 16: | Line 16: | ||
This can be easily done, first, you need to know that special membergroup ID, go to ''''Edit Membergroups'''', in your admin center, there you should see your membergroup, click on the ''''Modify'''' link of your membergroup, then in the URL you should see something like this: 'action=membergroups;sa=edit;id=#'. | This can be easily done, first, you need to know that special membergroup ID, go to ''''Edit Membergroups'''', in your admin center, there you should see your membergroup, click on the ''''Modify'''' link of your membergroup, then in the URL you should see something like this: 'action=membergroups;sa=edit;id=#'. | ||
You should see a number | You should see a number instead of the blue '#' shown, that number is that membergroup ID. | ||
Now that you got the membergroup ID, we can continue. This is the code we will be using: | Now that you got the membergroup ID, we can continue. This is the code we will be using: | ||
Line 49: | Line 49: | ||
$ssi_layers = array('main'); | $ssi_layers = array('main'); | ||
Simple write these variables in your SSI page before the incude | Simple write these variables in your SSI page before the incude statement, here is a working example: | ||
{{code|1=<nowiki> | {{code|1=<nowiki> | ||
<?php | <?php | ||
Line 65: | Line 65: | ||
</nowiki>}} | </nowiki>}} | ||
Let's explain the above code: | |||
*''$ssi_gzip = false;'' means gzip is turned off. | *''$ssi_gzip = false;'' means gzip is turned off. | ||
Line 72: | Line 72: | ||
*''$ssi_layers = array('main');'' uses the pair of main sub templates. | *''$ssi_layers = array('main');'' uses the pair of main sub templates. | ||
*''ob_start();'' is needed not to get errors. | *''ob_start();'' is needed not to get errors. | ||
*''require("/SSI.php");'' note | *''require("/SSI.php");'' note it's after the variables, but before any output. | ||
Dont worry if it looks a bit hard, this is the expert faq. :) Just experiment with it and you will get the hang of it. | Dont worry if it looks a bit hard, this is the expert faq. :) Just experiment with it and you will get the hang of it. | ||
Line 78: | Line 78: | ||
---- | ---- | ||
Well this pretty much covers the expert Guide, | Well this pretty much covers the expert Guide, don't quote me on this, but maybe i'll write a Master SSI FAQ later on. | ||
Copied from http://www.simplemachines.org/community/index.php?topic=13205.0 | |||
[[Category:Developing SMF]] | |||
[[Category:Integrating SMF]] | |||
[[Category:SSI]] |
Latest revision as of 01:06, 11 April 2021
Expert SSI FAQ
Hello and welcome to the Expert SSI FAQ, in this FAQ you will learn expert stuff with SSI, this FAQ is written assuming you have already read the 'Basic SSI FAQ' and 'Advanced SSI FAQ'. This FAQ has commonly asked SSI questions as well as some tips and tricks.
**PLEASE DO NOT EDIT YOUR 'SSI.PHP' FILE**
Everything done here is done without having to edit 'SSI.php'
How can I check if a user is part of a special membergroup?
We have already learned how to tell if a person is a guest, user or admin, but now we can also check if a user is part of a special membergroup, lets take an example to help us out:
Example:
You have a site, and a forum, and you have made a special membergroup where some users are part of, you want that membergroup to have access to a special page, and other users will see an error message.
This can be easily done, first, you need to know that special membergroup ID, go to 'Edit Membergroups', in your admin center, there you should see your membergroup, click on the 'Modify' link of your membergroup, then in the URL you should see something like this: 'action=membergroups;sa=edit;id=#'. You should see a number instead of the blue '#' shown, that number is that membergroup ID.
Now that you got the membergroup ID, we can continue. This is the code we will be using: We are assuming that id=9 is our special membergroup for our example!
<?php if (in_array(9, $user_info['groups'])) { echo 'Yay! Im in group 9!'; } else { echo 'We are sorry, it seems you dont have access to this page.'; } ?>
Well thats how you can do that, you guys know the rest! :P
Is there anything else?
Glad you asked, because just so happens as there is some more, SSI has some advanced configuration that you can define with a simple code, here are the configurations that you can change.
$ssi_gzip = 'true/false'; $ssi_ban = 'true/false'; $ssi_theme = ' themeID# '; $ssi_layers = array('main');
Simple write these variables in your SSI page before the incude statement, here is a working example:
<?php $ssi_gzip = false; $ssi_ban = true; $ssi_theme = '2'; $ssi_layers = array('main'); ob_start(); require("/SSI.php"); ?>
Let's explain the above code:
- $ssi_gzip = false; means gzip is turned off.
- $ssi_ban = true; means a banned forum user will be banned also in the SSI page.
- $ssi_theme = '2'; uses the theme [images, buttons, colors] with ID=2, which usually is classic theme.
- $ssi_layers = array('main'); uses the pair of main sub templates.
- ob_start(); is needed not to get errors.
- require("/SSI.php"); note it's after the variables, but before any output.
Dont worry if it looks a bit hard, this is the expert faq. :) Just experiment with it and you will get the hang of it.
Well this pretty much covers the expert Guide, don't quote me on this, but maybe i'll write a Master SSI FAQ later on.
Copied from http://www.simplemachines.org/community/index.php?topic=13205.0