Welcome to Geeklog Saturday, September 22 2018 @ 04:27 pm EDT

Geeklog Forums

Frontpage hacked again


Status: offline

James Fryer

Forum User
Junior
Registered: 06/08/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.

PHP 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'];
 

Status: offline

MLimburg

Forum User
Chatty
Registered: 17/12/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.

Status: offline

James Fryer

Forum User
Junior
Registered: 06/08/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 (??)

Status: offline

jimphelps

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

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

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