TYPO3 API  SVNRelease
class.tx_statictemplates.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  (c) 2009-2011 Benjamin Mack (benn@typo3.org)
00007 *  All rights reserved
00008 *
00009 *  This script is part of the TYPO3 project. The TYPO3 project is
00010 *  free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  The GNU General Public License can be found at
00016 *  http://www.gnu.org/copyleft/gpl.html.
00017 *  A copy is found in the textfile GPL.txt and important notices to the license
00018 *  from the author is found in LICENSE.txt distributed with these scripts.
00019 *
00020 *
00021 *  This script is distributed in the hope that it will be useful,
00022 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 *  GNU General Public License for more details.
00025 *
00026 *  This copyright notice MUST APPEAR in all copies of the script!
00027 ***************************************************************/
00028 
00029 class tx_statictemplates {
00030 
00031 
00032     /**
00033      * Includes static template records from static_template table, loaded through a hook
00034      *
00035      * @param   string      A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records, "static" for "static_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion.
00036      * @param   string      The id of the current template. Same syntax as $idList ids, eg. "sys_123"
00037      * @param   array       The PID of the input template record
00038      * @param   array       A full TypoScript template record
00039      * @return  void
00040      */
00041     public function includeStaticTypoScriptSources(&$params, &$pObj) {
00042             // Static Template Records (static_template): include_static is a
00043             // list of static templates to include
00044         if (trim($params['row']['include_static'])) {
00045             $includeStaticArr = t3lib_div::intExplode(',', $params['row']['include_static']);
00046                 // traversing list
00047             foreach ($includeStaticArr as $id) {
00048                     // if $id is not already included ...
00049                 if (!t3lib_div::inList($params['idList'], 'static_' . $id)) {
00050                     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_template', 'uid = ' . intval($id));
00051                         // there was a template, then we fetch that
00052                     if ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00053                         $subrow = $pObj->prependStaticExtra($subrow);
00054                         $pObj->processTemplate($subrow, $params['idList'] . ',static_' . $id, $params['pid'], 'static_' . $id, $params['templateId']);
00055                     }
00056                     $GLOBALS['TYPO3_DB']->sql_free_result($res);
00057                 }
00058             }
00059         }
00060     }
00061 }
00062 
00063 ?>