Customizing SMF > Modifications and Packages

Site Integration Mod

(1/61) > >>

Nathaniel:
Site Integration Mod Version 1.41 by LHVWBOverview:

This mod helps webmasters to integrate their websites with SMF. It achieves this by allowing admin to include their '.php' files as actions into the SMF system, thus allowing their site to share the theme, template, login system and etc. of SMF.

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 the SMF theme from 'index.php?action=(filename without trailing '.php').

I made this mod because I think that there needs to be an easier way to integrate small php scripts and HTML pages into SMF without using the normal SSI.php functions.

Features Explained:

Settings are found in the admin panel:
For SMF 1.1.5: "Features and Options" section-> "Site Integration" tab.
For SMF 2.1 Beta: "Configuration" dropdown menu -> 'Modifications' -> 'Site Integration' Tab.
* Includes .php files as actions: This is the main function of the Mod, in order for this to work you need to add some folders to the "File/Action Include Folders" setting, so that the system can include files.
* Manage Included Files/Actions: This functionality is provided by a list of included files/actions within the settings area, it allows you to set custom permissions for your included files/actions and also give them a title which will be shown in the browser window. You can also choose to show the action in the WhosOnline list for the forums.

* Change Home/Default Action: This functionality is provided by the "Forum Default/Home Action" setting, it 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.

* Show Special Action for invalid actions: This functionality is provided by the "Invalid Action Error Action" setting, it 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.
* Language Includes (only important if you are using more than one language): The language include settings are very useful if you want to add multiple languages to your included files/actions, they allow you to specify folders, in which the Mod will search for a '(current action).(current language).php' file, as well as any specified "Site-Wide Language Integration Files" that it can find. 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 (eg $text['welcome']='Welcome to my Website!') in multiple language files and then access it later (eg echo($text['welcome'])).
Further explanation of feature functionality can be found by clicking on the [?] help button next to each setting.

Demo Sites:

SMF 1.1.5: http://www.verbtest.com/smfdemo/index.php
SMF 2 Beta: http://www.verbtest.com/smf2demo/index.php

Important Information:

This Mod should work for all templates, however for custom templates you may wish to edit the 'template_SiteIntegration()' function in the 'SiteIntegration.template.php' template file.

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, but your file is being included from a function, meaning that they are not automatically there. You will have to include any global variables that you need, below is an example of how to do that.


--- Code: ---global $var;
Or for multiples:  global $var1, $var2, etc.;

--- End code ---

You can use any of the functions which are defined by SMF from within the php code on your pages, by using the require_once() function to include them. However because the file is included from within the template, you cannot change any major settings from within your files.

Also be aware that when you view your page it will be treated as if it is at the root of your SMF directory, because of the integration. This will effect any relative locations which you are trying to use.

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.smfsite.com/index.php").


--- Code: ---<?php
$smfurl = '{web adress of your SMFs index.php}';
if (!defined('SMF'))
  header('Location: '.$smfurl.'?action='.substr(basename($_SERVER['SCRIPT_FILENAME']), 0, strpos(basename($_SERVER['SCRIPT_FILENAME']), '.')));
?>

--- End code ---

Version Changes:

v1.41
Updated for SMF 1.1.6 and SMF 2 Beta 4.0.

v1.4 Changes.
A minor bugfix, there was a HTML error in the template file, also fixed displaying of Mod version.
Removed 'official' support for SMF 1.1.4 and SMF 2 Beta 3.0, although the mod should still work for them.
Added settings to change home/default and error actions.
Added option to display the title of an included action in the whosonline list.
Added the use of custom file extensions.
Added a language string prefix for included titles, and implemented checking for a language string for them.

v1.3.1 Changes.
A minor bugfix, two of the settings had similar names so this created an annoying bug.
Updated version 1.3 so that it supports SMF 1.1.5 and 1.1.4.

v1.3 Changes.
Added permissions and title management of included files/actions.
Fixed up all errors which were occurring with PHP4.
Removed semi-completed language translations.

v1.12. Changes:
Added support for PHP 4.
Small Bugfixes.

v1.11. Changes:
Re-Added support for SMF 1.1.4.

v1.1. Changes:
Support for multiple file/action include folders added.
Support for SMF 1.1.4 Removed.
Menu System Split into a separate Mod (Under Construction).
Language Support for English-utf8 added.

Any feedback on this Mod and ways to improve it would be most welcome, 
Thank you. :)
LHVWB

Apllicmz:
did have demo...

translate Portuguese

help


--- Code: ---<file name="$themedir/languages/Help.portuguese-utf8.php" error="skip">
<operation error="skip">
<search position="before"><![CDATA[
$helptxt = array();
]]></search>
<add><![CDATA[

// Help for the Site Integration Mod
$helptxt['integrationmod_site_includes_folders'] = 'Esta configura&#231;&#227;o permite a voc&#234; adicionar v&#225;rias pastas, por que os separam por v&#237;rgulas. Todas as situa&#231;&#245;es. Php esses arquivos em pastas ser&#227;o convertidas em ac&#231;&#245;es atrav&#233;s da SMF.<br/><br/>Observe que a pasta nomes s&#227;o relativos &#224; SMF diret&#243;rio home. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br/><br/>Note tamb&#233;m que n&#227;o importa se voc&#234; usar barras no in&#237;cio ou no fim da pasta nomes, eles est&#227;o no meio nessesario por&#233;m se voc&#234; estiver tentando carregar uma sub-pasta (eg. \'file_includes/files\').';

]]></add>
</operation>
</file>
<file name="$themedir/languages/Help.brazilian-utf8.php" error="skip">
<operation error="skip">
<search position="before"><![CDATA[
$helptxt = array();
]]></search>
<add><![CDATA[

// Help for the Site Integration Mod
$helptxt['integrationmod_site_includes_folders'] = 'Esta configura&#231;&#227;o permite a voc&#234; adicionar v&#225;rias pastas, por que os separam por v&#237;rgulas. Todas as situa&#231;&#245;es. Php esses arquivos em pastas ser&#227;o convertidas em ac&#231;&#245;es atrav&#233;s da SMF.<br/><br/>Observe que a pasta nomes s&#227;o relativos &#224; SMF diret&#243;rio home. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br/><br/>Note tamb&#233;m que n&#227;o importa se voc&#234; usar barras no in&#237;cio ou no fim da pasta nomes, eles est&#227;o no meio nessesario por&#233;m se voc&#234; estiver tentando carregar uma sub-pasta (eg. \'file_includes/files\').';

]]></add>
</operation>
</file>
--- End code ---



Help not utf8


--- Code: ---<file name="$themedir/languages/Help.portuguese.php" error="skip">
<operation>
<search position="before"><![CDATA[
$helptxt = array();
]]></search>
<add><![CDATA[

// Help for the Site Integration Mod
$helptxt['integrationmod_site_includes_folders'] = 'Esta configuração permite a você adicionar várias pastas, por que os separam por vírgulas. Todas as situações. Php esses arquivos em pastas serão convertidas em acções através da SMF.<br/><br/>Observe que a pasta nomes são relativos à SMF diretório home. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br/><br/>Note também que não importa se você usar barras no início ou no fim da pasta nomes, eles estão no meio nessesary porém se você estiver tentando carregar uma subpasta (eg. \'file_includes/files\').';

]]></add>
</operation>
</file>
<file name="$themedir/languages/Help.brazilian.php" error="skip">
<operation>
<search position="before"><![CDATA[
$helptxt = array();
]]></search>
<add><![CDATA[

// Help for the Site Integration Mod
$helptxt['integrationmod_site_includes_folders'] = 'Esta configuração permite a você adicionar várias pastas, por que os separam por vírgulas. Todas as situações. Php esses arquivos em pastas serão convertidas em acções através da SMF.<br/><br/>Observe que a pasta nomes são relativos à SMF diretório home. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br/><br/>Note também que não importa se você usar barras no início ou no fim da pasta nomes, eles estão no meio nessesary porém se você estiver tentando carregar uma subpasta (eg. \'file_includes/files\').';

]]></add>
</operation>
</file>
--- End code ---


modification


--- Code: ---<file name="$themedir/languages/Modifications.portuguese-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[

// Site Integration Text.
$txt['integrationmod_generalsettings_heading'] = 'P&#225;ginas em Geral integra&#231;&#227;o configura&#231;&#245;es';
$txt['integrationmod_tab_heading'] = 'P&#225;gina Integra&#231;&#227;o';
$txt['integrationmod_site_includes_folders'] = 'Arquivo / ac&#231;&#227;o incluem pastas:';

]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.brazilian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[

// Site Integration Text.
$txt['integrationmod_generalsettings_heading'] = 'P&#225;ginas em Geral integra&#231;&#227;o configura&#231;&#245;es';
$txt['integrationmod_tab_heading'] = 'P&#225;gina Integra&#231;&#227;o';
$txt['integrationmod_site_includes_folders'] = 'Arquivo / ac&#231;&#227;o incluem pastas:';

]]></add>
</operation>
</file>
--- End code ---

Nathaniel:
Thank you for translating it, :)

I will add aditional translations when I do another version.

Any comments or suggestions?

_Anthony_:
I do not understand.
Please tell me how this modification works.
And if they wanted to integrate the site with the forums could they not just use the functions in SSI.php?

Eliana Tamerin:
Wow, how did I manage to miss this?

* Eliana Tamerin bugs the customization team to sort by approval date instead of submission date again.
Sounds like a great concept. I look forward to seeing some people integrate their normal HTML sites with SMF without having to know loads of php.

Navigation

[0] Message Index

[#] Next page

Go to full version