Welcome to Geeklog, Anonymous Monday, November 25 2024 @ 06:46 pm EST

Geeklog Forums

frontpage static page using PHP


Status: offline

gHack

Forum User
Junior
Registered: 12/20/02
Posts: 15
Location:Boulder, CO

Should I submit this as a bug or a hack? dunno...

It's a hack to fix a bug that happens when you're using staticpages 1.2, you want to use a static page as your frontpage and the static page you want to use contains PHP.

Since the hack that allows you to do static front pages is in public_html/index.php, it doesn't get updated when you install staticpages 1.2. There are only three lines that need to be updated (as far as I can tell).

Line 83,

Text Formatted Code
         $spsql = "SELECT sp_content,sp_label,sp_format FROM {$_TABLES['staticpage']} WHERE sp_title = 'frontpage'";
 

should be changed to:

Text Formatted Code
         $spsql = "SELECT sp_content,sp_label,sp_format,sp_php FROM {$_TABLES['staticpage']} WHERE sp_title = 'frontpage'";
 

and lines 98 and 110, which are identical,

Text Formatted Code
             $display .= stripslashes ($spresult['sp_content']);
 

should be replaced with:

Text Formatted Code
             if ($spresult['sp_php'] == '1') {
                 $display .= eval (stripslashes ($spresult['sp_content']) );
             } else {
                 $display .= stripslashes ($spresult['sp_content']);
             }
 

This seems to work fine.

 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Since Static Pages 1.2 (and hence the use of PHP in Static Pages) is not part of Geeklog (yet), this is obviously not a bug (at least not in Geeklog). Geeklog 1.3.8 will include an updated version 1.3 of the Static Pages plugin that will support PHP in Static Pages "out of the box" - on the front page, too. bye, Dirk
 Quote

Status: offline

gHack

Forum User
Junior
Registered: 12/20/02
Posts: 15
Location:Boulder, CO
Note that performing this hack will break your display if you're only using staticpages 1.1. -Chris
 Quote

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