Ticket #171: 021_templates_page_output.diff
| File 021_templates_page_output.diff, 4.5 kB (added by rho, 1 year ago) |
|---|
-
a/index.php
old new 5 5 require_once(dirname(__FILE__)."/includes.php"); 6 6 templates_page_setup(); 7 7 if (logged_on) { 8 $body = templates_draw(array( 9 'context' => 'frontpage_loggedin' 10 ) 11 ); 8 templates_page_output($CFG->sitename, null, 'frontpage_loggedin'); 12 9 } else { 13 $body = templates_draw(array( 14 'context' => 'frontpage_loggedout' 15 ) 16 ); 10 templates_page_output($CFG->sitename, null, 'frontpage_loggedout'); 17 11 } 18 19 echo templates_page_draw( array(20 $CFG->sitename,21 $body22 )23 );24 12 25 13 ?> -
a/lib/templates.php
old new 1588 1588 } 1589 1589 } 1590 1590 1591 /** 1592 * Outputs html page 1593 * @param string $title The title of the page 1594 * @param string $body The body of the content 1595 * @param string $context Optional template context 1596 * @param string $sidebar Optional sidebar content 1597 */ 1598 function templates_page_output($title, $body, $context='contentholder', $sidebar=null) { 1599 // hook pre-output page 1600 // @rho i think no needed because there is already 1601 // _init and _pagesetup 1602 1603 // allow title with html tags or specialchars 1604 $body = templates_draw(array( 1605 'context' => $context, 1606 'title' => $title, 1607 'body' => $body, 1608 )); 1609 1610 // clean title for <title> tag 1611 $title = htmlspecialchars_decode(strip_tags($title), ENT_COMPAT); 1612 1613 // print output! 1614 echo templates_page_draw(array($title, $body, $sidebar)); 1615 1616 // hook post-output 1617 action('end'); 1618 1619 // end execution 1620 exit(); 1621 } 1622 1623 // backward compatiblity for php < 5 1624 if (!function_exists('htmlspecialchars_decode')) { 1625 function htmlspecialchars_decode($string, $quote_style=ENT_COMPAT) { 1626 return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS/*, $quote_style*/))); 1627 } 1628 } 1629 1630 1591 1631 ?> -
a/login/index.php
old new 49 49 $body = __gettext('Please log in'); 50 50 templates_page_setup(); 51 51 // display the form. 52 echo templates_page_draw( array( 53 sitename, 54 templates_draw(array( 55 'body' => $body, 56 'title' => __gettext('Log On'), 57 'context' => 'contentholder' 58 ) 59 ) 60 ) 61 ); 52 templates_page_output($CFG->sitename, $body); 62 53 63 54 ?> -
a/profile/edit.php
old new 53 53 } else { 54 54 $body = $profile->display_form(); 55 55 } 56 $body = templates_draw(array( 'context' => 'contentholder',57 'title' => $title,58 'body' => $body ));59 56 60 print templates_page_draw(array($title, $body)); 61 62 57 templates_page_output($title, $body); 63 58 64 59 function profile_update($profile_new) { 65 60 -
a/profile/index.php
old new 308 308 // $title = 'Profile'; 309 309 $view = $profile->view(); 310 310 311 $body = templates_draw( array( 312 'context' => 'contentholder', 313 'title' => $title, 314 'body' => $view['body'], 315 )); 316 317 //echo templates_page_draw(array($title, $body, NULL, $view['widgets'])); 318 echo templates_page_draw(array($title, $body)); 311 templates_page_output($title, $view['body']); 319 312 320 313 ?>
