473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Showing a weekly program

Maybe I haven't been able to find the answer in Google because I didn't know
how it is called exactly but I am still puzzling about an easy solution to
update weekly the services of the local church. It should be done without
mySql. The ideal situation would be that php could read the appropiate data
from a text file, so the text file can be easily edited and uploaded by one
of the church's voluntary workers.
The text file could look like

Zaterdag 25 oktober.
10:00 Pastor P. Jansen
11:00 Pastor W. Dirksen
Zondag 26 oktober.
12:00 Pastor P. Dirks
Zaterdag 1 november
10:00 Pastor J.Hendriks
Zondag 2 november
9:00 Pastor G. de Vries

I would like a function that reads the whole tekst and only publishes the
services for the next weekend. I think I will be able to make a function
that converts the date written in Dutch to an English string and than this
will be converted to a real date, but how can I make php show not only the
date but also the services for that weekend?

If there is info on the web about this, please tell me what keywords I
should enter in Google.

Thanks for any reaction
Martien van Wanrooij
Jul 17 '05 #1
6 1923
I noticed that Message-ID: <sUBmb.2426$2o2.18092@amstwist00> from
Martien van Wanrooij contained the following:
Maybe I haven't been able to find the answer in Google because I didn't know
how it is called exactly but I am still puzzling about an easy solution to
update weekly the services of the local church. It should be done without
mySql. The ideal situation would be that php could read the appropiate data
from a text file, so the text file can be easily edited and uploaded by one
of the church's voluntary workers.


It's a shame if you don't have access to MySQL. I have written an event
management system that does use MySql and will send you a link to the
test pages for you to try it by email. Updating the events is done via
a web interface. On the web page, the events automatically update
themselves. Events which are in the past are simply not shown.
http://www.antiqueforumgroup.com/pages/brumam.php

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
Ben
"Martien van Wanrooij" <in**@martienvanwanrooij.nl> wrote in message news:<sUBmb.2426$2o2.18092@amstwist00>...
Maybe I haven't been able to find the answer in Google because I didn't know
how it is called exactly but I am still puzzling about an easy solution to
update weekly the services of the local church. It should be done without
mySql. The ideal situation would be that php could read the appropiate data
from a text file, so the text file can be easily edited and uploaded by one
of the church's voluntary workers.
The text file could look like

Zaterdag 25 oktober.
10:00 Pastor P. Jansen
11:00 Pastor W. Dirksen
Zondag 26 oktober.
12:00 Pastor P. Dirks
Zaterdag 1 november
10:00 Pastor J.Hendriks
Zondag 2 november
9:00 Pastor G. de Vries

I would like a function that reads the whole tekst and only publishes the
services for the next weekend. I think I will be able to make a function
that converts the date written in Dutch to an English string and than this
will be converted to a real date, but how can I make php show not only the
date but also the services for that weekend?

If there is info on the web about this, please tell me what keywords I
should enter in Google.

Thanks for any reaction
Martien van Wanrooij


Maybe you could use the function

switch

case
Jul 17 '05 #3
"Martien van Wanrooij" <in**@martienvanwanrooij.nl> wrote
in message news:<sUBmb.2426$2o2.18092@amstwist00>...

The ideal situation would be that php could read the appropiate data
from a text file, so the text file can be easily edited and uploaded
by one of the church's voluntary workers.
The text file could look like

Zaterdag 25 oktober.
10:00 Pastor P. Jansen
11:00 Pastor W. Dirksen
Zondag 26 oktober.
12:00 Pastor P. Dirks
Zaterdag 1 november
10:00 Pastor J.Hendriks
Zondag 2 november
9:00 Pastor G. de Vries

I would like a function that reads the whole tekst and only publishes
the services for the next weekend.


Let me try to help, but you'll have to excuse me for my truly
atrocious Dutch... :)

Let's say you made a slight modification to your file format:

Dadel: Zaterdag 25 oktober.
10:00 Pastor P. Jansen
11:00 Pastor W. Dirksen
Dadel: Zondag 26 oktober.
12:00 Pastor P. Dirks
Dadel: Zaterdag 1 november
10:00 Pastor J.Hendriks
Dadel: Zondag 2 november
9:00 Pastor G. de Vries

Then you could do something like this:

function parseServiceSchedule() {
$monthsE = array ('January', 'February', 'March',
'April', 'May', 'June',
'July', 'August', 'September',
'October', 'November', 'December');
$monthsD = array ('januari', 'februari', 'maart',
'april', 'mei', 'juni',
'juli', 'augustus', 'september',
'oktober', 'november', 'december');
$daysE = array ('Sunday', 'Monday', 'Tuesday', 'Wednesday',
'Thursday', 'Friday', 'Saturday');
$daysD = array ('zondag', 'maandag', 'dinsdag', 'woensdag',
'donderdag', 'vrijdag', 'zaterdag');
$schedule = file ('rooster.txt');
$output = false;
foreach ($schedule as $line) {
if ($dateD = strstr ($line, 'Dadel:')) {
$output = false;
$dateE = str_replace ($monthsD, $monthsE, $dateD);
$dateE = str_replace ($daysD, $daysE, $dateE);
$timestamp = strtotime ($dateE);
$target = strtotime ('next Saturday 12:00 AM');
if (($timestamp > $target) and
(($timestamp - $target) < (48*60*60))) {
$output = true;
}
}
if ($output) {
echo $line;
}
}
}

Cheers,
NC
Jul 17 '05 #4
....Just sent a reply and realized there were a couple of bugs
in it... Here's the updated (and tested) version:

function parseServiceSchedule() {
$monthsE = array ('January', 'February', 'March',
'April', 'May', 'June',
'July', 'August', 'September',
'October', 'November', 'December');
$monthsD = array ('januari', 'februari', 'maart',
'april', 'mei', 'juni',
'juli', 'augustus', 'september',
'oktober', 'november', 'december');
$daysE = array ('Sunday', 'Monday', 'Tuesday', 'Wednesday',
'Thursday', 'Friday', 'Saturday');
$daysD = array ('Zondag', 'Maandag', 'Dinsdag', 'Woensdag',
'Donderdag', 'Vrijdag', 'Zaterdag');
$schedule = file ('rooster.txt');
$output = false;
foreach ($schedule as $line) {
if ($dateD = strstr ($line, 'Dadel:')) {
$output = false;
$dateE = str_replace ('Dadel:', '', $dateD);
$dateE = str_replace ($monthsD, $monthsE, $dateE);
$dateE = str_replace ($daysD, $daysE, $dateE);
$timestamp = strtotime ($dateE);
$target = strtotime ('next Saturday 12:00 AM');
if (($timestamp >= $target) and
(($timestamp - $target) < (48*60*60))) {
$output = true;
}
}
if ($output) {
echo $line;
}
}
}

Cheers,
NC
Jul 17 '05 #5

"Nikolai Chuvakhin" <nc@iname.com> schreef in bericht
news:32*************************@posting.google.co m...
...Just sent a reply and realized there were a couple of bugs Thank you Nikita, this is really very helpfull. My major problem was the
fact that the date has to be evaluated on these lines were there *is" really
a date in it and I was puzzling how to avoid evaluation of lines without the
date. $schedule = file ('rooster.txt'); I didn't know that accessing a file is that easy. Most documentation talks
about fopen() and similar functions. $dateE = str_replace ($monthsD, $monthsE, $dateE);
$dateE = str_replace ($daysD, $daysE, $dateE);

Another facility that was new for me: the replacing can obviously done by
searching two arrays.
Thanks again,
Martien van Wanrooij
Jul 17 '05 #6

"Martien van Wanrooij" <in**@martienvanwanrooij.nl> schreef in bericht
news:s7Pmb.2487$2o2.18108@amstwist00...
Thank you Nikita, this is really very helpfull.

Oops, I mean Nikolai ! :-) Sorry...
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Cameron Laird | last post by:
QOTW: "The lesson for me is to spend much less time on Python discussion and much more on unfinished projects. So even if I never use the new syntax, I will have gained something ;-)" - Terry...
1
by: Damien Ramsey | last post by:
hello there Info: I have a form on which is displayed information, customer code, address and balance etc.. on that form i also have start of the current week, which is displaying 29th march...
0
by: Cameron Laird | last post by:
ANNOUNCEMENT: we had an incident with backups of the "Python-URL!" mailing list. It's possible we lost one or two transactions from the last week. If you aren't receiving an e-mailed copy of...
0
by: Cameron Laird | last post by:
QOTW: "In short, it's never what you think it is ;-)" - timbot, probably on the subject of performance "Real efficiency comes from elegant solutions, not optimized programs. Optimization is...
1
by: Cameron Laird | last post by:
QOTW: "sing Python is not programming, it IS a fun!" - Tolga "The reason for making complex a builtin is _not_ to ease a single program, but to create a convention allowing different modules...
0
by: Cameron Laird | last post by:
QOTW: "I can't say enough about Python and agile programming. Piecing together small, well-documented, well-tested pieces of software makes solving big problems easier." - Shannon Behrens of...
0
by: Gabriel Genellina | last post by:
QOTW: "edundant/useless/misleading/poor code is worse than wrong." - Michele Simionato http://groups.google.com/group/comp.lang.python/msg/74adbb471826a245 "Unit tests are not a magic wand that...
0
by: Gabriel Genellina | last post by:
QOTW: "If you really want to learn hard-core Python, probably your best bet is: * read everything Tim Peters has ever written in comp.lang.python (this will take a few months), start with "import...
0
by: Gabriel Genellina | last post by:
QOTW: " is not just some stupid thing." - Alan Runyan http://wiki.python.org/moin/buildout has more background sum() doesn't use the best possible algorithm when dealing with floating point...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.