Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

very simple one line cms?

0 views
Skip to first unread message

1

unread,
Aug 3, 2004, 5:00:59 AM8/3/04
to
hi all
i need to have a page on a clients site that has a competition question that
changes weekly.
they need to be able to change the question through some kind of admin page
(i was going to make a separate page that was password protected for this
purpose).
now i am thinking using MySQL etc will be like using a sledghammer to crack
a nut open, and am wondering if there is some simpler way of implementing
this using maybe basic PHP and an external text file or something? or maybe
i dont even require PHP?
any ideas appreciated.
thanks


Perttu Pulkkinen

unread,
Aug 3, 2004, 5:32:12 AM8/3/04
to
"1" <1...@1.com> kirjoitti viestissä news:2n92i8F...@uni-berlin.de...

> hi all
> i need to have a page on a clients site that has a competition question
that
> changes weekly.

If its okay, why not include a textfile inside pre-tags or you can also put
string trough this kind of php-function

function html_inclusion($file)
{
- open that file into string
- put string trough htmlspecialchars (maybe do striptags first)
- str_replace \n with <br>
- echo that string
}

then they can use ftp to update that textfile


Gregory Toomey

unread,
Aug 3, 2004, 5:33:35 AM8/3/04
to
1 wrote:

I use www.mamboserver.com for my personal site (see signature).
Its a Content Management System based on PHP.

Mambo allows for website content to have a start date & end date. So a new
question would appear at the appropriate time


gtoomey
www.gregorytoomey.com

1

unread,
Aug 3, 2004, 5:47:47 AM8/3/04
to
yup i do too, but its way too much just for this system.
i need a really simple form with one text field, when they hit submit it
publishes to the page...
thanks


"Gregory Toomey" <nos...@bigpond.com> wrote in message
news:2n94fkF...@uni-berlin.de...

Steve

unread,
Aug 3, 2004, 6:11:43 AM8/3/04
to
In news:2n95a1F...@uni-berlin.de,

1 <1...@1.com> said:
> yup i do too, but its way too much just for this system.
> i need a really simple form with one text field, when they hit submit
> it publishes to the page...
> thanks

I would allow this form just to write to a text file, and the webpage can
just pull the content from the text file using PHP or server-side includes
or whatever you have at your disposal.


--
Steve


1

unread,
Aug 3, 2004, 6:34:53 AM8/3/04
to
yup that would be exactly it.
any pointers on how to accomplish this? i am a bit of a newbie as far as php
is concerned.
thanks

"Steve" <st...@somewhere.invalid.com> wrote in message
news:zxJPc.21058179$Of.34...@news.easynews.com...

Geoff Berrow

unread,
Aug 3, 2004, 12:59:58 PM8/3/04
to
I noticed that Message-ID: <2n92i8F...@uni-berlin.de> from 1
contained the following:

>hi all
>i need to have a page on a clients site that has a competition question that
>changes weekly.
>they need to be able to change the question through some kind of admin page
>(i was going to make a separate page that was password protected for this
>purpose).
>now i am thinking using MySQL etc will be like using a sledghammer to crack
>a nut open,

Maybe, but you could do other cool stuff like put in a load of
questions and having them change each week automatically. I've used a
database for a list of events and found it worth its weight in gold.
Set it and forget it. Of course you can charge the client for weekly
updates..:-)

But if you just want to write to a text file, I posted a script a few
days ago that allows you to do just that. You'll have to hack it a bit.

www.ckdog.co.uk/logger/display.php

To edit the file:
http://www.ckdog.co.uk/logger/editlog.php

Let me know if you want it.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

Toby Inkster

unread,
Aug 3, 2004, 2:10:41 PM8/3/04
to
1 wrote:

> i need to have a page on a clients site that has a competition question that
> changes weekly.

Do you also need to collect the answers to the competition? Or are those
collected by e-mail or something?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Now Playing ~ ./dido/life_for_rent/02_-_stoned.ogg

BasherB

unread,
Aug 3, 2004, 6:46:49 PM8/3/04
to
This may help, may not:
Hope it does.

PAGE 1
*************** ADDS NEW QUESTION FORM AND WRITES THE TO QUESTION.TXT
PAGE *********************


<?php
$filename = "question.txt";
$seperator = "/ENDOFLINE/";
if (isset ($_POST['Submit'])){
$new_question = sprintf ("%s$seperator\r\n%s$seperator\r\n",
addslashes($_POST['question']), addslashes($_POST['answer']));
if (!$handle = fopen($filename, "r+")){
echo "cannot open file to edit question";
exit;
}
fwrite ($handle, $new_question);
fclose ($handle);
header ("Location:viewquestion.php");
exit;
}
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>"
method="post">question:<input name="question" type="text"><br>
answer:<input name="answer" type="text"><br>
<input name="Submit" type="submit" value="Submit">
</form>

PAGE 2
********* WILL PLACE ALL OF THE QUESTIONS AND ANSWERS INTO AN ARRAY
******
**** >SPLIT THEM UP INTO A QUESTIONS AND ANSWERS ARRAY IF YOU WISH<
******

<?php
$filename = "question.txt";
$seperator = "/ENDOFLINE/";

if (!$handle = fopen ($filename, "r")){
echo "cannot access question file";
exit;
}
$contents = fread ($handle, filesize ($filename));
fclose ($handle);

$all = explode ($seperator, $contents);
foreach ($all as $question){
echo stripslashes($question).'<br>';
}
?>

1

unread,
Aug 4, 2004, 5:54:20 AM8/4/04
to
yeah collect the answers too
undecided if this will be by email or not

"Toby Inkster" <usenet...@tobyinkster.co.uk> wrote in message
news:pan.2004.08.03....@tobyinkster.co.uk...

0 new messages