Fixed #11356: Backend Login News is not templateable
authorBenni Mack <benni.mack@typo3.org>
Sun, 21 Jun 2009 14:50:18 +0000 (14:50 +0000)
committerBenni Mack <benni.mack@typo3.org>
Sun, 21 Jun 2009 14:50:18 +0000 (14:50 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5605 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/index.php
typo3/templates/login.html

index c9ab415..a0339e3 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-21  Benjamin Mack  <benni@typo3.org>
+
+       * Fixed #11356: Backend Login News is not templateable
+
 2009-06-21  Rupert Germann  <rupi@gmx.li>
 
        * Fixed bug #11358: typoLink() perfomance improvement (thanks to Vladimir Podkovanov)
index 923cf09..87872f7 100644 (file)
@@ -533,38 +533,38 @@ class SC_index {
        }
 
        /**
-        * Make login news - renders the HTML content for a list of news shown under the login form. News data is added through $TYPO3_CONF_VARS
+        * Make login news - renders the HTML content for a list of news shown under
+        * the login form. News data is added through $TYPO3_CONF_VARS
         *
         * @return      string          HTML content
         * @credits                     Idea by Jan-Hendrik Heuing
         */
-       function makeLoginNews()        {
-
-                       // Reset output variable:
-               $newsContent= '';
+       function makeLoginNews() {
+               $newsContent = '';
 
                        // Traverse news array IF there are records in it:
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']))  {
-                       foreach($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] as $newsItem)    {
-                               $newsContent .= '<dt>'.htmlspecialchars($newsItem['header']).' <span>'.htmlspecialchars($newsItem['date']).'</span></dt>';
-                               $newsContent .= '<dd>'.trim($newsItem['content']).'</dd>';
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'])) {
+
+                               // get the main news template, and replace the subpart after looped through 
+                       $newsContent      = t3lib_parsehtml::getSubpart($GLOBALS['TBE_TEMPLATE']->moduleTemplate, '###LOGIN_NEWS###');
+                       $newsItemTemplate = t3lib_parsehtml::getSubpart($newsContent, '###NEWS_ITEM###');
+
+                       $newsItemContent = '';
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] as $newsItem) {
+                               $newsItemMarker = array(
+                                       '###HEADER###'  => htmlspecialchars($newsItem['header']),
+                                       '###DATE###'    => htmlspecialchars($newsItem['date']),
+                                       '###CONTENT###' => trim($newsItem['content'])
+                               );
+                               $newsItemContent .= t3lib_parsehtml::substituteMarkerArray($newsItemTemplate, $newsItemMarker);
                        }
 
-                       $title = ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle']) : $GLOBALS['LANG']->getLL('newsheadline', true));
-                               // Wrap
-                       $newsContent = '
-
-                                       <!--
-                                               Login screen news:
-                                       -->
-                                       <h2 id="loginNewsTitle">'.$title.'</h2>
-                                       <dl id="loginNews">
-                                               '.$newsContent.'
-                                       </dl>
-                       ';
+                       $title = ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] : $GLOBALS['LANG']->getLL('newsheadline'));
+
+                       $newsContent = t3lib_parsehtml::substituteMarker($newsContent,  '###NEWS_HEADLINE###', htmlspecialchars($title));
+                       $newsContent = t3lib_parsehtml::substituteSubpart($newsContent, '###NEWS_ITEM###', $newsItemContent);
                }
 
-                       // Return content:
                return $newsContent;
        }
 
index 13f4fd5..bab7adb 100644 (file)
 </table>
 <!-- ###LOGOUT_FORM### end -->
 
+<!-- ###LOGIN_NEWS### begin -->
+       <!-- Login screen news: -->
+       <h2 id="loginNewsTitle">###NEWS_HEADLINE###</h2>
+       <dl id="loginNews">
+        <!-- ###NEWS_ITEM### begin -->
+                               <dt>###HEADER### <span>###DATE###</span></dt>
+                               <dd>###CONTENT###</dd>
+        <!-- ###NEWS_ITEM### end -->
+       </dl>
+<!-- ###LOGIN_NEWS### end -->
\ No newline at end of file