Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...
Author Message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Thu Jun 09, 2005 12:04 pm Reply with quote

Looking for something that will fetch the last 5 or 10 (preferably configurable) news articles from my site and drop them in a stand alone page.
I have the html tables etc done as I am not using nuke for this - the page has its own html footer/heder etc.

I am stumped with the best way to grab the last 5/10 news items to dop in the page though.
Obviously I'll need to 'include' config.php to ensure the DB connection details are relatively secure but have absolutely NO idea on the sql statement to use.

Has anyone seen anything like this or give me a pointer or three?

I really must get a grip on this coding stuff Sad
 
View user's profile Send private message Send e-mail
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Jun 09, 2005 12:55 pm Reply with quote

Well, depending on exactly what information you're after, you could do
Code:
$fetchAmount = 10;

$sql = "SELECT * FROM ".$prefix."_stories ORDER BY sid DESC limit $fetchAmount";
 
View user's profile Send private message
Guardian2003







PostPosted: Thu Jun 09, 2005 11:53 pm Reply with quote

Thanks Raven, that gives me a good starting point.
In an ideal world, I would like the article title followed by the text in the 'Story Text' field. I'm then going to hard code a 'See More' link which will take people to the main site.

For those that are interested, I'm doing this because of the restrictions in the nuke layout. Hopefully I can make this available to all as an alternative 'starting page' for their site or for anyone who might need a dedicated 'news' page for google etc.
 
Raven







PostPosted: Thu Jun 09, 2005 11:56 pm Reply with quote

Guardian2003 wrote:
For those that are interested, I'm doing this because of the restrictions in the nuke layout.


Care to elaborate?
 
Guardian2003







PostPosted: Fri Jun 10, 2005 2:05 am Reply with quote

Sure thing.
A friend of mine, who's wife is obsessed with Harry Potter (I cannot think why) wanted a specific type of layout for the 'front page' of the site - something a little different.
There was no way with my meagre knowledge that I could get specific blocks/modules to display where she wanted them so we are going to basically create a new page layout and then pull certain data into the page.
The 'new' menu will be hard linked taking visitors to the underlying nuke site etc.

So I guess in a way it will be like a custom theme file but just for the frontpage.
I have the news working now(thanks).
 
Guardian2003







PostPosted: Fri Jun 10, 2005 4:01 am Reply with quote

Loads of workstill to be done but here is what I have so far;
http://www.the-forbidden-forest.net/newsite/index1.php
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Seeking applications ...

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©