Firefox PHP

Integration Enabled Template Design

Posted by Joe Curia 
Integration Enabled Template Design
March 04, 2009 07:08PM
My External Authentication module now supports integration enabled templates for embedding within external applications. The basic idea behind an integration enabled template is that certain elements should be separated (such as header tags) or made optional (such as login/logout links).

Here are the standards I am proposing for integration enabled templates:
  1. The integration enabled design elements will in no way hinder a template from being used as a standalone template. Thus any and all templates can be integration enabled and can be used in embedded forums as well as standalone installations.
  2. The template will have an integration_variables.php file which will place certain variables into the global $PHORUM["DATA"] array. By default these variables will be set to FALSE for use in a standalone installation. Some default variables are:
    1. HIDE_LOGO: This variable can be enabled to hide the templates logo area. When building the template, that area should check this variable before being displayed. (ie. {IF NOT HIDE_LOGO} logo area {/IF} )
    2. HIDE_WELCOME: This variable can be enabled to hide the welcome message.
    3. HIDE_BREADCRUMBS: This variable can be enabled to hide the breadcrumbs.
    4. HIDE_FOOTER: This variable can be enabled to hide the "This forum is powered by Phorum" message.
  3. The header.tpl file will be split and designed to be integrated within and external application.
    1. The INTEGRATE_HEADER variable will determine whether the template should output the header content.
    2. A header_content.php file will be created to contain any header tags. These tags will be written to a $header_content variable. This will allow the external application to include this file and add the $header_content data to its own header tag system. The header_content.php file will be called from within the header.tpl file and will print the $header_content data if the INTEGRATE_HEADER variable is not set. Here is an example from the header.tpl in the Generic Integration template:
      {IF NOT INTEGRATE_HEADER}  <?php  if ($PHORUM['DATA']['CHARSET']) {  header("Content-Type: text/html; charset=".htmlspecialchars($PHORUM['DATA']['CHARSET']));  echo '<?xml version="1.0" encoding="'.$PHORUM['DATA']['CHARSET'].'"?>';  } else {  echo '<?xml version="1.0" ?>';  }  ?>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">  <html xmlns="[www.w3.org]; xml:lang="{LOCALE}" lang="{LOCALE}">  <head>  {INCLUDE "header_content"}  </head>  <body onload="{IF FOCUS_TO_ID}var focuselt=document.getElementById('{FOCUS_TO_ID}'); if (focuselt) focuselt.focus();{/IF}">  {/IF}
  4. The footer.tpl file will also be written to reflect the INTEGRATE_HEADER variable. This will suppress the output of the </body> and </html> tags as necessary.
  5. A color_variables.php file will be created to declare the various color variables used by the template. This will allow the external application to easily discover and overwrite these variables for better integration.
  6. CSS reset script will be inserted into the beginning of the css.tpl file which will establish standard CSS values for most HTML elements before applying the template sets its own css values. This will allow the template to be integrated into an external application's own css-based template without worrying about inheriting the externarl application's css settings.
  7. All images will be coded in such a way as to be accessible when called from an embedded template.
  8. All Login, Logout, and Register links will be coded in such a way that if the pertinent url is not provided, there will be no code outputted to the HTML sent to the browser. For example:
    {IF URL->LOGINOUT}<small>(<a href="{URL->LOGINOUT}">{LANG->LogOut}</a>)</small>&nbsp;&nbsp;{/IF}
I have created a Generic Integration template based on the Lightweight template with the integration enabled design. This template can be used as an example for future integration enabled templates.

I am open to any and all criticisms of this design standard. I would encourage any template developers to adopt this standard so that future integration efforts can make use of their templates.

I would like to thank Maurice Makaay for his input in the past. His pointers on how to best embed a template have directed much of my thinking when creating this standard. That is not to say he endorses this standard (yet :-P ) but I would be remiss if I did not mention the help I have received from him. Maurice, I hope you will help solidify this standard (or another like it) so that future template and module development can have a standard way of enabling integration of Phorum as an embedded page within an external application.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Integration Enabled Template Design
June 26, 2009 02:30PM
This sounds like a very well-thought-out solution to a wide range of problems, but the code you mention seems to only appear in the Dupral section of the External Authentication module.

Am I correct in concluding that those of us using Elgg would have to somehow port the changes from the Dupral to the Elgg version to be able to utilize any of these features?

Thanks!
Re: Integration Enabled Template Design
June 26, 2009 05:51PM
I didn't see this post when I created my templates. These sound like some good ideas. I wouldn't be opposed to updating some or all of my templates to this new standard, but time doesn't permit right now.

I just modified several of my templates, which I'll be uploading later today. By the way, if anyone has any suggestions or comments for me about any of my templates, let me know.

-------------------------------------------------------------------
"When given a choice, always choose monkeys."
Re: Integration Enabled Template Design
August 19, 2011 06:54PM
Thanks for your effort in doing this! The idea behind the integration template is quite helpful for my current project about the immigration from a CMS. And the source code did a lot help for the guiding of my parts of coding.
Sorry, only registered users may post in this forum.

Click here to login