TYPO3 API  SVNRelease
freesite_dummy_page_menu.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 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Dummy menu of templates/dummy pages on the FreeSite Application.
00029  *
00030  * This displays a menu with links to each dummy page set following the uid of the base template to use. Used for preview of the base templates.
00031  * Required: The Freesite Application (extension: "freesite")
00032  *
00033  * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj
00034  * XHTML compliant
00035  *
00036  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00037  */
00038 
00039 
00040 if (!is_object($this)) {
00041     die ('No cObj object present. This script must be included as a PHP_SCRIPT cObject in TypoScript!');
00042 }
00043 
00044     // Template
00045 $pid = intval($conf['pid_templateArchive']);
00046 $content = '';
00047 
00048 $specialComment='';
00049 if ($pid)   {
00050         // Select templates in root
00051         // Does NOT take TSFE->showHiddenRecords into account!
00052     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'pid='.intval($pid).' AND deleted=0 AND hidden=0 AND starttime=0 AND endtime=0', '', 'sorting');
00053     while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
00054         if (!$firstUID) $firstUID = $row['uid'];
00055         $key = $row['uid'];
00056         $val = $row['title'];
00057         $content.= '<a target="testTemplate" href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.'index.php?id='.$GLOBALS['TSFE']->id.'&based_on_uid='.$key).'">'.$val.'</a><br />';
00058         $specialComment.= '[globalVar= based_on_uid='.$key.']'.LF;
00059     }
00060         // Select subcategories of template folder.
00061     $page_res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'pid='.intval($pid).' AND deleted=0 AND hidden=0 AND starttime=0 AND endtime=0 AND fe_group=0', '', 'sorting');
00062     while($page_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($page_res)) {
00063             // Subcategory templates
00064         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_template', 'pid='.intval($page_row['uid']).' AND deleted=0 AND hidden=0 AND starttime=0 AND endtime=0', '', 'sorting');
00065         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))   {
00066             if (!$firstUID) $firstUID = $row['uid'];
00067             $key = $row['uid'];
00068             $val = $page_row['title'].' / '.$row['title'];
00069             $content.= '<a target="testTemplate" href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.'index.php?id='.$GLOBALS['TSFE']->id.'&based_on_uid='.$key).'">'.$val.'</a><br />';
00070             $specialComment.= '[globalVar= based_on_uid='.$key.']'.LF;
00071         }
00072     }
00073 }
00074 
00075 $content.='
00076 <!--
00077 
00078 NOTE:
00079 When updating the template archive, these TypoScript conditions should replace the current conditions found in the DUMMY PAGE test template:
00080 
00081 
00082 '.$specialComment.'
00083 
00084 -->
00085 ';
00086 
00087 ?>