News:

Wondering if this will always be free?  See why free is better.

Main Menu

Site Integration Mod

Started by live627, April 29, 2008, 07:45:20 PM

Previous topic - Next topic

live627

Link to the mod

Site Integration Mod

MIT license GitHub issues Latest Version Support

Package name SMF version Minimmum PHP version
Site Integration Mod 2.0.0 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

View changelog

Overview

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`).

  • Create custom pages for your forum that may be accessed via direct link (smf.example.com/index.php?action=demo)
  • Select membergroups that can access the actions
  • Choose an action to use as a landing page instead of the board index
  • Choose an action for errors (invalid or missing actions) instead of the board index
    • Does not change the standard error for missing or hidden topics
  • Elect whether or not to show the action's name in Who's Online

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.

Features Explained:

Settings are found in the admin panel: "Configuration" dropdown menu -> 'Modifications' -> 'Site Integration' Tab.

  • 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 feature functionality can be found by clicking on the [?] help button next to each setting.

Important Information

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']), '.');

Tutorial

View more tutorials

Create a simple action

  1. Create directory file_includes in SMF root ($boarddir)
  2. Create file in said directory demo.php
  3. Save the following code to it
    <?php
    
    echo 'Hello world';
    
  4. Navigate browser to Administration Center » Configuration » Modifications » Site Integration
    1. Click "Manage" for settings specific to the demo action
      • "File/Action Include Folders" MUST include file_includes or no files will be found
    2. Enter the name and choose the group permisisons, click "Save"
    3. Click "demo" in the management table to view the action
      • The address bar should show smf.example.com/index.php?action=demo

Adding menu buttons for your actions

Download Ultimate Menu for your menu building needs


Apllicmz

did have demo...

translate Portuguese

help

<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>




Help not utf8

<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>



modification

<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>



Nathaniel

Thank you for translating it, :)

I will add aditional translations when I do another version.

Any comments or suggestions?
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

_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.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Nathaniel

Quote from: MrMoney on April 30, 2008, 07:13:32 PM
I do not understand.
Please tell me how this modification works.

I am sorry if my explanation is a little bit complicated, I will try to work on it.

This Mod creates a setting in the "features and settings" ("modifications" for smf 2 beta) part of the admin section, which allows you to make a list of folders. Every '.php' file from each of these folders will be added as an action into the SMF system, allowing for easier integration. To access the action for a particular file you type in "index.php?action=(filename without the trailing '.php')".

Quote from: MrMoney on April 30, 2008, 07:13:32 PM
And if they wanted to integrate the site with the forums could they not just use the functions in SSI.php?

Yes, this Mod performs a similar task to the SSI.php functions, except that it is much easier to setup and means that people don't have to worry about calling certain functions or learning how to use the functions. It also means that your entire site looks fully integrated with SMF because it uses the SMF action system, ie index.php?action=(filename without the trailing '.php').

This Mod was also going to originally have a Custom Menu system, which would have included custom permissions for actions, but I have spilt that into another Mod which I should complete in a week or two.

As I have already said, I am planning to put in some more usefull integration settings, such as login/logout redirect actions and etc. Any suggestions as to useful features for integration that you think this Mod could have would be most welcome.

The general idea of this Mod is that its easy to use, much easier than the SSI.php method.

Thank you for your comments.
:)

SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Apllicmz

You can do a demo and that which are pages which supports .. because I am using joomla and possibly



_Anthony_


Nathaniel

#8
Demo is located at www.verbtest.com

All I had to do to setup the demo, was to install the Mod, upload some files to the /demo folder, and then type 'demo' for the folder includes setting.

Easy!  ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Apllicmz

It works so with version 2.0



Nathaniel

#10
* Updated

v1.13. Changes:
Added Portugues and Brazilian thanks to joomlamz.
Updated the Mod to work with SMF 1.1.5.

It will still works perfectly with SMF 1.1.4,

I have made a SMF 1.1.5 demo at http://www.verbtest.com/smfdemo/

joomlamz, you didn't post any non-utf8 "language.modifications.php" translation so I just copied the utf-8 ones, could you please post back if this is a problem.

Thank you,
LHVWB
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

damnitmike

This mod has me interested....but when I go to the demo, all I see is a page of code....

It looks like it is trying to show a file, but permissions don't allow it???

Do you need to be logged in to see it???

I'll keep watching this mod......it looks like it has some nice possibilities.


Apllicmz

thank You Update Now

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

// Site Integration Text.
$txt['integrationmod_generalsettings_heading'] = 'Paginas em Geral integração configurações';
$txt['integrationmod_site_includes_folders'] = 'Ficheiro/acção incluem pastas:';

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

// Site Integration Text.
$txt['integrationmod_generalsettings_heading'] = 'Paginas em Geral integração configurações';
$txt['integrationmod_site_includes_folders'] = 'Ficheiro/acção incluem pastas:';

]]></add>
</operation>
</file>



Nathaniel

Changes:
I have improved the clarity of my explanations about the Mod on the Mod page. I have also update the Mod to version 1.2 which includes the language include options that allow the actions/files to have multi-language support much more easily. Below is an example of how this could work.

Example website settings.
File/Action Include Folders:  'action_includes'
Language File Include Folders: 'language_includes'
Site-Wide Language Integration Files: 'site_language_support'

I have two files in the 'action_includes' folder:
"demo.php"

<?php
echo($general_text);
echo(
$demo_text);
?>


"demo2.php"

<?php
echo($general_text);
echo(
$demo_text);
?>


I have six files in the 'language_includes' folder:

"demo.english.php".

<?php
$demo_text 
"English Demo1 text.";
?>


"demo.french-utf8.php".

<?php
$demo_text 
"French Demo1 text.";
?>


"demo2.english.php".

<?php
$demo_text 
"English Demo2 text.";
?>


"demo2.french-utf8.php".

<?php
$demo_text 
"French Demo2 text.";
?>


"site_language_support.english.php".

<?php
$general_text 
"English General Site Language Support text.";
?>


"site_language_support.french-utf8.php".

<?php
$general_text 
"French General Site Language Support text.";
?>


When I load the actions with the english language these are the outputs:

"index.php?action=demo"
Quote
English General Site Language Support text.
English Demo1 text.

"index.php?action=demo2"
Quote
English General Site Language Support text.
English Demo2 text.

When I load the actions with the french-utf8 language these are the outputs:

"index.php?action=demo"
Quote
French General Site Language Support text.
French Demo1 text.

"index.php?action=demo2"
Quote
French General Site Language Support text.
French Demo2 text.


SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Nathaniel

#14
Sorry joomlamz, because I have added more text to the Mod there is more to translate. If anyone wants to add any translations to the mod then the langauge strings are below.

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

// Site Integration Mod Text.
$txt['integrationmod_generalsettings_heading'] = 'General Site Integration Settings';
$txt['integrationmod_tab_heading'] = 'Site Integration';
$txt['integrationmod_site_includes_folders'] = 'File/Action Include Folders:';
$txt['integrationmod_site_language_includes_folders'] = 'Language File Include Folders:';
$txt['integrationmod_site_general_language_files'] = 'Site-Wide Language Integration Files:';

]]></add>
</operation>
</file>
<file name="$themedir/languages/Help.english.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'] = 'This settings allows you to add multiple folders, by separating them with commas. All of the .php files in those folders will be turned into actions by SMF.<br/><br/>Please Note that the folder names are relative to the SMF home directory. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br /><br />Also Note that it doesn\'t matter if you use forward slashes at the beginning or end of the folder names, they are however nessesary in the middle if you are trying to load a subfolder (eg. \'file_includes/files\').';
$helptxt['integrationmod_site_language_includes_folders'] = 'If your site only uses one language then ignore this option. <br /><br />This settting allows you to make a list of folders, separated by commas. When you view one of the actions/files loaded by this Mod using the previous setting, SMF will search through these folders for any language include files, in a way similar to the inbuilt SMF language system.<br /><br />First it will search for a specific language file for the current action (ie. "(current action).(User\'s current SMF language).php"). For example, when the action is \'demo\' and the langauge is \'english-utf8\' it will look for \'demo.english-utf8.php\'.<br /><br /> It will also search for any general site-wide language include files in these folders (refer to the next setting). <br /><br /> Within the actual language files themselves, you can declare string variables that you can then use in your action to make your actions have multiple language translations.';
$helptxt['integrationmod_site_general_language_files'] = 'If your site only uses one language then ignore this option. <br /><br />This setting allows you to add a series of general site-wide language includes, separated by commas. When the system searches through your language include folders (refer to above setting), it will always include language files which have this prefix, no matter which action you are viewing.<br /><br /> For example, when the language is french-utf8 and the action is demo, but you have set a general language include called \'sitelanguage\', it will look for and include \'demo.french-utf8.php\' and \'sitelanguage.french-utf8.php\'. <br /><br /> Setting variables and using them works exactly the same for these site-wide language includes, as for the language includes discussed in the previous settings help pop-up.';

]]></add>
</operation>
</file>


Quote from: damnitmike on May 01, 2008, 10:35:26 AM
This mod has me interested....but when I go to the demo, all I see is a page of code....

It looks like it is trying to show a file, but permissions don't allow it???

Do you need to be logged in to see it???

I'll keep watching this mod......it looks like it has some nice possibilities.


damnitmike,

I am not entirely sure what you are refering to. The page which is link as the demo is meant to show some code as example to show you how to protect your pages and etc.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Apllicmz

#15
Thank you  now try o translate to see how she work...

try to see in attach Portuguese and brazilian.xml



Edit: Update Now Thank you



Nathaniel

#16
Okay, thanks joomlamz.

I have updated the Mod with support for brazilian and portuguese. The edits in the brazilian.xml file that you sent me were editing the portuguese files, I changed them to brazilian. They are both in the additional_languages.xml file in my mod.

I don't have time to test it at the moment, I will probably test it with those languages in a few hours.

Thank you for the translations.

Edit: I did some testing and it appears that some of the translations are still in english. Could you please fix this and then re-post them?
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Eclipse16V

How can Guests see any site?

When an Guest click on an page, hi must be log in.
I worked with:
SMF 2 in German

Shop:
SID Giessen

Nathaniel

I can't completely understand what you are trying to say, but if you want to retrict user access to any of these mod pages then you can do it using the allowedTo() function.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Eclipse16V

Rear one, yes and as I installation? Where? What? I want to be able to see that guests certain sides and other sides only for user am visible. Thanks
I worked with:
SMF 2 in German

Shop:
SID Giessen

Advertisement: