Welcome to Geeklog, Anonymous Tuesday, December 24 2024 @ 09:32 pm EST

Geeklog Forums

List all static pages?


julianna

Anonymous
Is there any way to create a static page that will list all static pages (without having to create the links manually)?
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
here you go Julianna...
This is in the form of a phpblock function--easy to incorporate into your php enabled staticpage.
Text Formatted Code
//list of links to all staticpages user has access to
function phpblock_listStaticpages()
{
    global $_TABLES, $_CONF;
    $result = DB_query("SELECT sp_id, sp_title FROM {$_TABLES['staticpage']}" . COM_getPermSQL( 'WHERE' ));
    if (DB_numRows($result) < 1){
        $retval = '';
    } else {
        $retval = '<ul>' . LB;
        while ($A = DB_fetchArray($result)){
            $sp_id = stripslashes($A['sp_id']);
            $sp_title = stripslashes($A['sp_title']);
            $spUrl = COM_buildUrl( $_CONF['site_url'] . '/staticpages/index.php?page=' . $sp_id );
            $retval .= '<li><a href="' . $spUrl . '">' . $sp_title . '</a></li>' . LB;
        }
        $retval .= '</ul>' . LB;
    }
    return $retval;
}


 
 Quote

julianna

Anonymous
Thanks!
 Quote

All times are EST. The time is now 09:32 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