Additional Info |
---|
Type
|
Package ID
LHVWB:SMF_intergration_MOD
|
First Created
March 30, 2008, 07:25:44 AM
|
Last Updated
April 17, 2022, 01:52:27 AM
|
Package name | SMF version | Minimmum PHP version |
---|---|---|
Site Integration Mod 2.0.1 | SMF 2.0.x | PHP 7.0 |
Site Integration Mod 1.4.1 | SMF 1.1.x, 2.0.x | PHP 4.3 – PHP 5.4 |
The Mod works by looking in a series of specific folders (defined by the admin) for .php
files to include as actions, each included file will then be accessable within SMF from index.php?action=(filename without trailing .php
).
smf.example.com/index.php?action=demo
)This mod was borne of a desire for an easier way to integrate small php scripts and HTML pages into SMF without using the normal SSI.php functions.
Settings are found in the admin panel: Administration Center » Configuration » Modifications » Site Integration (or index.php?action=admin;area=modsettings;sa=siteintegration
).
Forum Default/Home Action: This allows you to change the home page of your forums. Please note that your Board Index will still be accessible (index.php?action=forum
). If you leave the setting blank then your normal Board Index will be your home page/action.
Invalid Action Error Action: This allows you to show a specific action every time an invalid action is passed by the user. If you don't set this then it will just show the home/default page.
Site-Wide Language Integration Files: (only important if you are using more than one language) Comma-seperated list of directories to search for language files in the form of (current action).(current language).php
. These files will then be included before your included file/action, so that you can use a language system similar to the SMF language system where you define the same text variable ($txt['welcome'] = 'Welcome to my Website!';
) in multiple language files and then access it later (eg echo $txt['welcome'];
).
Further explanation of a setting's functionality can be found by clicking on the [?] help button.
This Mod should work for all installed themes. However, if you wish to customize the default layout, you can edit the template_SiteIntegration()
function in the SiteIntegration.template.php
template file. Hint: copy this file to another theme to have a unique layout for that theme.
You have to set the permissions for all the includes actions/files that you want normal users or guests to see, by default every included action/file can only be seen by the admin of your website.
You can access any of the global variables from SMF, just like a mod. An example of declaring globals (this is easily forgotten):
global $var;
Or for multiples:
global $var1, $var2, $var3, ..., $varN;
You can use any of the functions which are defined by SMF from within the PHP code on your pages. Remember to include
the files first! (Refer to the Function Database)
The index pages from your folders will never be turned into actions. I would suggest that you copy an index.php page from one of the other SMF folders to protect your folders, so that people can't see a list of your files.
Finally note that you should always include the code below in all of your '.php ' files, so that if users try to view those files they will be redirected to the file's smf action. You only need to change the value of $smfurl to the web address of your SMF's index.php for it to work, ie. (http://www.smf.example.com/index.php
).
$smfurl = '{web adress of your SMFs index.php}';
if (!defined('SMF'))
header('Location: ' . $smfurl . '?action=' . strtok(basename($_SERVER['SCRIPT_FILENAME']), '.');
file_includes
in SMF root ($boarddir
)demo.php
<?php
echo 'Hello world';
demo
action
file_includes
or no files will be found
smf.example.com/index.php?action=demo
Download Ultimate Menu for your menu building needs