Welcome to Geeklog, Anonymous Wednesday, December 25 2024 @ 09:46 pm EST
Geeklog Forums
staticpage in header.thtml
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
You can put php into header.thtml. It gets evaluated before display. So just include code to load a static page and call SP_render_page() inside < ?php ... ?> block.
9
8
Quote
Status: offline
ivy
Forum User
Full Member
Registered: 11/25/04
Posts: 314
Location:Tokyo Japan
Thanks jmucchiello!
But I was not able to look for SP_render_page().
mystral-kk Japanese member made program CUSTOM_getStaticpage().
You can put php code into header.thtml or staticpage.
<?php echo CUSTOM_getStaticpage( 'id' ); ?>
Wiki:
http://wiki.geeklog.jp/index.php/CUSTOM_getStaticpage%28%29
Geeklog Japan https://www.geeklog.jp
But I was not able to look for SP_render_page().
mystral-kk Japanese member made program CUSTOM_getStaticpage().
You can put php code into header.thtml or staticpage.
<?php echo CUSTOM_getStaticpage( 'id' ); ?>
Wiki:
http://wiki.geeklog.jp/index.php/CUSTOM_getStaticpage%28%29
Geeklog Japan https://www.geeklog.jp
11
8
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
My mistake, it's called SP_render_content. Change you function to:
/**
* Returns a staticpage
*
* @param $sp_id string an id of a staticpage
* @return string the content of the staticpage
*/
function CUSTOM_getStaticpage( $sp_id ) {
global $_TABLES, $_PLUGINS, $_SP_CONF, $LANG_STATIC;
$retval = '';
if ( !in_array( 'staticpages', $_PLUGINS ) ) {
return $retval;
}
$sql = "SELECT sp_php, sp_content FROM {$_TABLES['staticpage']} "
. "WHERE (sp_id = '" . addslashes( $sp_id ) . "') "
. "AND " . SP_getPerms();
$result = DB_query( $sql );
if ( DB_error() OR DB_numRows( $result ) == 0 ) {
return $retval;
} else {
$A = DB_fetchArray( $result );
$sp_php = $A['sp_php'];
$sp_content = stripslashes( $A['sp_content'] );
$retval = SP_render_content($sp_content, $sp_php); // new in 1.4.1
}
return $retval;
}
?>
Text Formatted Code
<?php/**
* Returns a staticpage
*
* @param $sp_id string an id of a staticpage
* @return string the content of the staticpage
*/
function CUSTOM_getStaticpage( $sp_id ) {
global $_TABLES, $_PLUGINS, $_SP_CONF, $LANG_STATIC;
$retval = '';
if ( !in_array( 'staticpages', $_PLUGINS ) ) {
return $retval;
}
$sql = "SELECT sp_php, sp_content FROM {$_TABLES['staticpage']} "
. "WHERE (sp_id = '" . addslashes( $sp_id ) . "') "
. "AND " . SP_getPerms();
$result = DB_query( $sql );
if ( DB_error() OR DB_numRows( $result ) == 0 ) {
return $retval;
} else {
$A = DB_fetchArray( $result );
$sp_php = $A['sp_php'];
$sp_content = stripslashes( $A['sp_content'] );
$retval = SP_render_content($sp_content, $sp_php); // new in 1.4.1
}
return $retval;
}
?>
8
9
Quote
Status: offline
ivy
Forum User
Full Member
Registered: 11/25/04
Posts: 314
Location:Tokyo Japan
Thank a lot. Your code works great!
Geeklog Japan https://www.geeklog.jp
Geeklog Japan https://www.geeklog.jp
10
9
Quote
All times are EST. The time is now 09:46 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content