Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 05:13 pm EDT

Geeklog Forums

Frontpage hacked again


Status: offline

James Fryer

Forum User
Junior
Registered: 08/06/02
Posts: 17

I had a requirement for some pages of my site (under development).

This was to display a block of information about the topic, with the stories appearing below this.

I had various plans of how to do this but after seeing the "Staticpage on Frontpage" code I decided to adapt this slightly.

In the code below, if you have a topic named 'foobar', a static page labelled 'foobar' will be displayed before the news stories, if it exists.

Text Formatted Code

if( empty($topic) )
{
    $staticpage_title = 'frontpage';
}
else {
    $staticpage_title = $topic;
}
$spsql = "SELECT sp_content,sp_label FROM {$_TABLES['staticpage']} WHERE sp_title = '$staticpage_title'";
$spresult = DB_fetchArray( DB_query( $spsql ));
if( $spresult['sp_label'] == 'nonews' )
{
    $shownews = 'no';
}

$display .= $spresult['sp_content'];
 
 Quote

Status: offline

MLimburg

Forum User
Chatty
Registered: 12/17/01
Posts: 35
Location:Adelaide, AU
Oh, that's good. That's very nice dude. I'll take a longer look at it when I get a chance, and I think this can be integrated into CVS. Very slick, plus nice and simple.---Friends help you move. Real friends help you move bodies.
Friends help you move. Real friends help you move bodies.
 Quote

Status: offline

James Fryer

Forum User
Junior
Registered: 08/06/02
Posts: 17
I think you opened the door, I just stepped through it. I made a mistake in my terminology above, it is the *title* of the static page that needs to be the same as the topic ID. The only problem I can see with releasing this is if people already have a static page with the same title as a topic ID. But this is unlikely (??)
 Quote

Status: offline

jimphelps

Forum User
Junior
Registered: 10/10/02
Posts: 20
Cool hack but.... where are you placing this code? Thanks, Jim
 Quote

Status: offline

jimphelps

Forum User
Junior
Registered: 10/10/02
Posts: 20
OK. I found the spot. It is in the <PublicHTML>/index.php Thanks for a slick hack, Jim
 Quote

All times are EDT. The time is now 05:13 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