Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 04:55 am EST
Geeklog Forums
New staticpages
Status: offline
::Ben
Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Hello,
Taken from the coming staticpage what's new block function, here is the phpblock version.
This block allow you to show in a block (or a staticpage) the list of the new staticpages
function phpblock_new_staticpages ()
{
global $_CONF, $_TABLES, $_SP_CONF, $LANG_STATIC;
$newstaticpagesinterval = 1209600;
$includephp = 0;
$includecenterblocks = 0;
$retval = '';
$extra_sql = "";
if ($includecenterblocks == 0) {
$extra_sql =' AND sp_centerblock = 0';
}
if ($includephp == 0) {
$extra_sql .=' AND sp_php = 0';
}
$sql = "SELECT sp_id, sp_title
FROM {$_TABLES['staticpage']}
WHERE NOT ISNULL(sp_content) AND (sp_date >= (DATE_SUB(NOW(), INTERVAL {$newstaticpagesinterval} SECOND)))
{$extra_sql}
" . COM_getPermSQL( 'AND' ) . "
ORDER BY sp_date DESC LIMIT 15";
$result = DB_query( $sql );
$nrows = DB_numRows( $result );
if( $nrows > 0)
{
$newstaticpages = array();
for( $x = 0; $x < $nrows; $x++ )
{
$A = DB_fetchArray( $result );
$url = COM_buildUrl( $_CONF['site_url']
. '/staticpages/index.php?page=' . $A['sp_id'] );
$title = COM_undoSpecialChars( stripslashes( $A['sp_title'] ));
$titletouse = COM_truncate( $title, $_SP_CONF['title_trim_length'],
'...' );
if( $title != $titletouse )
{
$attr = array('title' => htmlspecialchars($title));
}
else
{
$attr = array();
}
$astaticpage = str_replace( '$', '$', $titletouse );
$astaticpage = str_replace( ' ', ' ', $astaticpage );
$newstaticpages[] = COM_createLink($astaticpage, $url, $attr);
}
$retval .= COM_makeList( $newstaticpages, 'list-new-comments' );
}
else
{
$retval .= $LANG_STATIC['no_new_pages'] . '<br' . XHTML . '>' . LB;
}
return $retval;
}
::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
Taken from the coming staticpage what's new block function, here is the phpblock version.
This block allow you to show in a block (or a staticpage) the list of the new staticpages
Text Formatted Code
function phpblock_new_staticpages ()
{
global $_CONF, $_TABLES, $_SP_CONF, $LANG_STATIC;
$newstaticpagesinterval = 1209600;
$includephp = 0;
$includecenterblocks = 0;
$retval = '';
$extra_sql = "";
if ($includecenterblocks == 0) {
$extra_sql =' AND sp_centerblock = 0';
}
if ($includephp == 0) {
$extra_sql .=' AND sp_php = 0';
}
$sql = "SELECT sp_id, sp_title
FROM {$_TABLES['staticpage']}
WHERE NOT ISNULL(sp_content) AND (sp_date >= (DATE_SUB(NOW(), INTERVAL {$newstaticpagesinterval} SECOND)))
{$extra_sql}
" . COM_getPermSQL( 'AND' ) . "
ORDER BY sp_date DESC LIMIT 15";
$result = DB_query( $sql );
$nrows = DB_numRows( $result );
if( $nrows > 0)
{
$newstaticpages = array();
for( $x = 0; $x < $nrows; $x++ )
{
$A = DB_fetchArray( $result );
$url = COM_buildUrl( $_CONF['site_url']
. '/staticpages/index.php?page=' . $A['sp_id'] );
$title = COM_undoSpecialChars( stripslashes( $A['sp_title'] ));
$titletouse = COM_truncate( $title, $_SP_CONF['title_trim_length'],
'...' );
if( $title != $titletouse )
{
$attr = array('title' => htmlspecialchars($title));
}
else
{
$attr = array();
}
$astaticpage = str_replace( '$', '$', $titletouse );
$astaticpage = str_replace( ' ', ' ', $astaticpage );
$newstaticpages[] = COM_createLink($astaticpage, $url, $attr);
}
$retval .= COM_makeList( $newstaticpages, 'list-new-comments' );
}
else
{
$retval .= $LANG_STATIC['no_new_pages'] . '<br' . XHTML . '>' . LB;
}
return $retval;
}
::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
15
13
Quote
Status: offline
LWC
Forum User
Full Member
Registered: 02/19/04
Posts: 818
Judging from this site, it treats updated pages like new pages. You then enter them and tell yourself "hey, I know that page already". It would be fine only it signaled the new parts (like "diff" in wiki). But it would probably be easier adding a "created at" date.
15
11
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Yes, for staticpages the What's New Block uses the update date. There is no created date field for a page. Personally, I wanted users to know if there either was a new page, or if one got updated.
If feel strongly about it, you could make a feature request on this. A created date could be added and an option in the config to allow just new pages, or new and updated pages.
Tom
One of the Geeklog Core Developers.
If feel strongly about it, you could make a feature request on this. A created date could be added and an option in the config to allow just new pages, or new and updated pages.
Tom
One of the Geeklog Core Developers.
13
14
Quote
All times are EST. The time is now 04:55 am.
- 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