Forum Moderators: coopster

Message Too Old, No Replies

Problems making a "dailies"-section

         

gjermund72

10:03 pm on Jan 28, 2006 (gmt 0)

10+ Year Member



Hello :)

I have a problem which have been annoying me for a while.
Im building a website.
On the site i want to have a "news"- or "dailies"-section. This means a section of the page which i can easily update only in seconds if i like, and that i get the wanted text out on the page immediately.
This without me having to manually update my index.html or index.php in e.g dreamweaver, and then uploading it to the server.
I have been searching the net for hours, to find a script ( free ) that can do this for me.
But, with no luck :-(
Anyone here know about such a script?
Im a newbie on php so i appreicate any help on the matter.

Best regards:

Gjermund

inveni0

10:08 pm on Jan 28, 2006 (gmt 0)

10+ Year Member



You need to use a Database and mySQL. It's the only way, my friend.

jatar_k

10:11 pm on Jan 28, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld gjermund72,

well, you could store that info in a database and have your main page always pull any stories that are marked for "frontpage" or something like that. If there are none there, then it won't show anything.

Then you could have a simple admin script where you can paste in and save you added content to the database and have a spot where you can set it to "frontpage".

We do have some threads in our PHP Library [webmasterworld.com] about working with mysql.

gjermund72

10:44 pm on Jan 28, 2006 (gmt 0)

10+ Year Member



Hello :)
Thanx, and thanx for the quick reply.
I have fully access to mysql, apache etc on the server hosting my site.
The problem is that im a newbie to the php-programming, and i need a relevant script fast :-/
You describe a solution in your answer to me.

Do you know anyone who can make such a script for me? ( Or if such a script is already out there, whre i can find it? )

And which is easy to use? Such like filling in the text one want to be shown on the page in the "news flash", and then hit a button?
Im willing to pay for such a script, but not very much..( since im not a rich man ) :)
Lets say 5-6 USD? Not to provoke someone, but thats what im physically able to offer ;-)

Best regards:

Gjermund

inveni0

10:46 pm on Jan 28, 2006 (gmt 0)

10+ Year Member



Because all servers, databases and tables are different, you'll need Dreamweaver if you're looking for a quick fix.

a1call

12:28 am on Jan 29, 2006 (gmt 0)

10+ Year Member



Hi gjermund72,
A wiki might be what you are looking for. You can always lock pages for unauthorized access and you can browser edit all pages.

gjermund72

10:23 am on Jan 29, 2006 (gmt 0)

10+ Year Member



Hello :)
Whats a "wiki"?
As said earlier..if anyone is willing to tell me where i can find a php-script that fixes this or can tell me how i can do it otherwise etc..i would surely appreicate it :)

jatar_k

4:38 am on Jan 30, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



thing is the script would be pretty simple to make but I doubt you could find one that is simple enough. It may take a little longer to make one than install one but it will help you cut your teeth on php/mysql.

>> but thats what im physically able to offer

most people are in the same situation that's why they start learning because time they may be able to free up. Sorry that amount wouldn't get you much.

here is a more explicit outline

create a mysql table, amybe something like this

news_id (auto_increment primary key)
newstitle (maybe varchar(100))
story (text)
frontpage (yes/no enum)

so once you have the table make a simple form, probably protected with an .htaccess file because it is easy. This form can be used to input your story, the form should mirror the table

news_id - don't worry about it mysql will take care of this
newstitle - a textfield with size and maxlength set to 100
story - textarea
frontpage - radios for yes and no

now you do a little php script that inserts it into the database. If you are the only one using it you could use a 'trusted' method to start where it doesn't do much error checking or input cleaning.

then on your mainpage you have a small chunk of php including the following steps

connect to mysql
select all news where frontpage=yes
loop through the reuls and display it

done

gjermund72

5:10 pm on Jan 30, 2006 (gmt 0)

10+ Year Member



Hello :)

Thanx for the answer.

1) I have to study php for a month to understand what you were talking about in your post.

2)When i at last understand it, I might try what you suggested, so thanx for the tip :)

Best regards:

Gjermund A

willybfriendly

6:04 pm on Jan 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to use a Database and mySQL. It's the only way, my friend.

Actually, as simple as what he is looking for a flat file solution might be easier. Sounds like he only wants to be able to update a few lines or a couple of paragraphs.

WBF

jatar_k

6:26 pm on Jan 30, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



true WBF

could do an append to a single dedicated file and then just use an include on the main page

willybfriendly

6:57 am on Jan 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe even easier. Just replace the file with the new one, if it is only a couple of paragraphs, and then include it. He doesn't indicate any need to maintain an archive.

<?
$target = $_SERVER['DOCUMENT_ROOT']."/../newscache.txt";
$fp = fopen($target, "r") or die("can't open the file");
while(!feof($fp))
$data = fgets($fp);
fclose($fp);
?>
<form action="script.php" method="post">
<textarea rows="40" cols="80" name="data">
<? echo $data;?>
</textarea>
</form>

script.php

<?
$data = $_POST(data);
$fp = fopen($target, "w+");
fwrite($fp, $data);
fclose($fp);
?>

index.php

<!-- include imported data here -->
<?
$target = $_SERVER['DOCUMENT_ROOT']."/../newscache.txt";
$fp = fopen($target, "r") or die("can't open the file");
while(!feof($fp))
$data = fgets($fp);
fclose($fp);
echo $data;
?>
<!-- end of import -->

Sloppy, but close. (I know, there is no submit button in the form, but the main idea is there...)

WBF

gjermund72

7:22 am on Jan 31, 2006 (gmt 0)

10+ Year Member



Hello again :)

Thanx for the tip.
Appreciate the feedback.
I think im gonna try php-nuke for a while, and look into your suggestions, after a while, when i have learned some more php-scripting.

Regards

Mokita

10:18 am on Jan 31, 2006 (gmt 0)

10+ Year Member



After hunting high and low for something suitable, I have just installed the free version of Cute News from cutephp.com on one of our sites. It is a wonderful, specialised news CMS script that doesn't require mySQL, it stores items and archives in flat files.

The only difference between the paid and free version, is the "Content Management Powered by CuteNews" message on the page is killed when you register.

gjermund72

12:12 pm on Jan 31, 2006 (gmt 0)

10+ Year Member



Ahh

Thanx for the tip :)
I will check that out also.
Any link to your site so that i could check it out? :)

coopster

12:54 pm on Jan 31, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Sorry, no personal urls allowed [webmasterworld.com] on the WebmasterWorld forums.

Mokita

11:22 pm on Jan 31, 2006 (gmt 0)

10+ Year Member



I just found a good collection of php News Scripts:

[sitescripts.com...]

Fusion News (free) looks really interesting.

To find live examples of CuteNews, simply search Google for the phrase "Content Management Powered by CuteNews" - you'll get heaps to view.

gjermund72

3:41 pm on Feb 1, 2006 (gmt 0)

10+ Year Member



Appreciate it :)