Official Website News

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Official Website News

Post by vitinho444 »

Hey guys, im here to ask you, what's the best way, to have news displayed on the main page of my website?

By best way i mean both nice to see, and easy to edit or create new posts.

Thanks a lot ;)
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Official Website News

Post by Jackolantern »

I think a CMS is over-kill just for the news section of your site. I think you would probably end up spending far more time getting used to its features and functions than it would take to write a simple news scripts.

Speaking of a news script, I don't think it would be that hard. You could have a separate table in your database where each row is a news story. Each news story could be time-stamped with the time it was entered. Then on your news page script, you can simply set up a FOR loop set to however many news stories you want to initially display (6 or 7 would probably be good). You do a SELECT query from the news table in DESC order and LIMIT 6 or 7 to match your FOR loop. Then just loop through them to print them out to the page.

You can then create a link to the next results. You could do this by setting up another script that will always act as the "next page", no matter how many pages deep they go. This can be done by passing a GET value with the last news result. For example, say you are displaying 7 news articles at a time. The link to the next page script would need to be passed the integer 8, since that is the next news article (extracting the 8 from the news front page script should not be too hard). Then on the next page script, you would SELECT from the news table in DESC order LIMIT 8, 7. The LIMIT starts at row 8, and grabs only the next 7. Then the next page script would create a link back to itself, but this time it would pass a GET value with the link of 15, so it will LIMIT 15, 7 the next time. And then it will pass GET 22, and on and on. So you are just adding 7 to the value passed by the GET value each time.

If you play around with this system and add what you need, I think it will work out for a simple news system :)
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Official Website News

Post by vitinho444 »

Yeah, i was thinking make a thing like that, in fact that's what i've been using from the day i start, but that still requires me to go to phpmyadmin, or maybe create a page for news enter. I will work with that np.

Thanks ;)
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Official Website News

Post by Jackolantern »

You hit the nail on the head. You need an admin-only news entry page. It will speed things up once you have it operational. Of course you are going to have to type in the news stories somewhere, but having it on a page will allow you to speed up certain aspects of it, such as allowing you to make radio buttons for the category, perhaps, instead of having to type it in manually. And creating a timestamp column in the news stories will keep you from having to date each post as well. If you just keep things like this in mind, a data entry page will help you to streamline the entry of the news. :cool:
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Official Website News

Post by vitinho444 »

Yeah, the time stamp is what im using for "news" in the main page of my browser based game (village wars)

For the admin only im planning do something like this:

newsCREATION.php:

Code: Select all

if(isset($_GET['admin'] == "MYNAME" && $_GET['code'] == /* some code */)
{
     // present the news creation details
}
else
{
    // present a 404 Not found error ;)
}
This will keep the "smartass" guys away from my news xd
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Official Website News

Post by vitinho444 »

Hey jackolantern, btw, can you open my website? www.oryzhon.com and see if you see it in english?

Just testing this:

Code: Select all

$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Official Website News

Post by Jackolantern »

Yep, it all appears English to me :)
The indelible lord of tl;dr
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: Official Website News

Post by vitinho444 »

Thanks, the multi lang works fine.
I will upload the news system tomorrow ;) thanks for the replies.
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
Post Reply

Return to “General Development”