473,396 Members | 2,111 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,396 software developers and data experts.

Get date from text/php-file

Allright, thank you guys!!
I got it going.
Now i have another question;

Is there a way to link a date to a persons name,
so i can get the pop-up, and the pop-up
then automatically grabs the right name, and displays it?

Thanks in advance.,..
Jul 17 '05 #1
11 3255
"krunkelgarten" <kr***********@hotmail.com> wrote in message
news:87**************************@posting.google.c om...
Allright, thank you guys!!
I got it going.
Now i have another question;

Is there a way to link a date to a persons name,
so i can get the pop-up, and the pop-up
then automatically grabs the right name, and displays it?

Thanks in advance.,..

if your site is small, put them all in a flat text file, or if your site is
larger, put them in a database
and have your popup script look up the date.

but a quick question, it seams like you already know the persons name,
becouse you have thier birthdate before you pop open the window, I assume
this is comming from some sort file.

so when you pop open the window, add the name to the script:
ie:
"MM_openBrWindow('http://www.nu.nl/script?$n=username','popup','width=300,he
ight=300')"
--
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #2
The site is quite small, i don't think a DB would be necessary..
But What i want is that the names are in the same line of the php-file
or something like that, because i want to give certain other people
acces to this file, and let them edit it online.. If the dates& names
are in one row, it's
the easiest for those other people..
Hope you understand..

Greetz Krunkelgarten
Jul 17 '05 #3
"krunkelgarten" <kr***********@hotmail.com> wrote in message
news:87**************************@posting.google.c om...
The site is quite small, i don't think a DB would be necessary..
But What i want is that the names are in the same line of the php-file
or something like that, because i want to give certain other people
acces to this file, and let them edit it online.. If the dates& names
are in one row, it's
the easiest for those other people..
Hope you understand..

Greetz Krunkelgarten

I guess my question is, when the page runs, does it look through (what ever
style db you use, flat file, etc..)
and see if there is a matching date to the current date? )this way it
doesn't pop a window every day?

If so, then you must be reading the entire line, date w/ name, in this case,
pass the name to the pop window as I posted earlier.

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #4
Well, i'm not sure, if it runs through the entire line,
but the "datum.php" looks like this:

<?php
// January
$datum[] = '1 January';

//February
$datum[] = '...';

// March
$datum[] = '...';

// April
$datum[] = '...';

// May
$datum[] = '...';

// June
$datum[] = '...';

// July
$datum[] = '...';

// August
$datum[] = '...';

// September
$datum[] = '...';

// October
$datum[] = '20 October';

//November
$datum[] = '...';

//December
$datum[] = '...';
?>

What i want is something like this:
// January
$datum[] = '1 January'; $person=John

So i can get a pop-up at the 1st, and then have the pop-up
window look for the right person, and display that person's name..
Hope you understand..

Greetz Krunkelgarten
Jul 17 '05 #5
"krunkelgarten" <kr***********@hotmail.com> wrote in message
news:87*************************@posting.google.co m...
Well, i'm not sure, if it runs through the entire line,
but the "datum.php" looks like this:

<?php
// January
$datum[] = '1 January';

What i want is something like this:
// January
$datum[] = '1 January'; $person=John

So i can get a pop-up at the 1st, and then have the pop-up
window look for the right person, and display that person's name..
Hope you understand..

Greetz Krunkelgarten


I do understand, but what I dont understand is why you do not grab the name
when you grab the date? so when you pop open the window, you send the name
with it. instead of going through the file, checking dates, finding a
matching one, poping a window, and having that same window look through and
pull the name from the exact same point that triggered the window pop.

first let me ask, is this file format set in stone?

if not, and you still want to keep it super simple
try this
// jan 1
$datum['01/01'] = "persons name"; // but this only works if you have no
dups
is this a birthday pop up? or like some famous person in this day?

you could do something like
$datum[1][1] = "person name for jan 1";
$datum[1][23] = "person name for jan 23";
...
...

then on your index page, include() this file,
and do this:

$person = $datum[$date("n")][$date("j")];
if ($person != "")
{
print html_pop_window_code;
}

please use a cookie, so the user doesn't get anoyed by the same window
poping up everytime they look at your index page.
you could set a cookie like setcookie("popperson",$person);
then modify the if to read:

if ( ($person != "") && ($_COOKIE['popperson'] != $person) )

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #6
Hi Count Scubula,

I tried everything what you wrote, but i couldn't get it to work..
Since i'm quite new to PHP, i even didn't understand some of your
sentences:
"first let me ask, is this file format set in stone?",
"but this only works if you have no dups".

The site i'm making is for a local(womens) soccer-team,
and the pop-up should come when one of the team-members has it's
birthday...

So my problem is still trying to get the pop-up with the name.
What i have is one php-file called datum.php:

<?php
// January
$datum[] = '2-1';
?>

In my index.php there is this in the body-tag:
<?php $today =date("j-n"); if (in_array($today, $datum)) { print
"onLoad=".$g_birthday_pop;}?>

$g_birthday_pop looks like this:
$g_birthday_pop = <<<EOT
"MM_openBrWindow('../pop-up.php?persoon=test','dames3','width=300,height=30 0')"
EOT;

You can see what way i want to tell the pop-up.. (persoon)
I really hope you can help me out...

And what it comes to the cookie, i don't expect visitors to visit the
site more than once a day...

Best wishes, and greetz, Krunkelgarten
Jul 17 '05 #7
"krunkelgarten" <kr***********@hotmail.com> wrote in message
news:87**************************@posting.google.c om...
Hi Count Scubula,

I tried everything what you wrote, but i couldn't get it to work.. What i have is one php-file called datum.php:

<?php
// January
$datum[] = '2-1';
?>

In my index.php there is this in the body-tag:
<?php $today =date("j-n"); if (in_array($today, $datum)) { print
"onLoad=".$g_birthday_pop;}?>

$g_birthday_pop looks like this:
$g_birthday_pop = <<<EOT
"MM_openBrWindow('../pop-up.php?persoon=test','dames3','width=300,height=30 0
')" EOT;

ok lets keep it realy simple:
make only this one modification to your datum file
<?php
// January
$datum['persons name'] = '2-1';
?>

make these changes to your index
<?php $today =date("j-n"); if (in_array($today, $datum)) { print
"onLoad=".$g_birthday_pop;}?>

$g_birthday_pop looks like this:
$g_birthday_pop = <<<EOT
"MM_openBrWindow('../pop-up.php?persoon={array_search($today, $datum)},'dames3','width=300,height=300')" EOT;

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #8
Hi there,

Again, i tried all of it,
but it still doesn't work;
I changed the datum.php file:
- // January
$datum[Krunkelgarten] = '3-1';

I changed the index, and the $g_birthday_pop...
The result is still a pop-up, but where the
person's name should be, i get:
- {array_search(, )}

And the title of that page is:
- pop-up.php?persoon={array_search(,%20)}

I really don't get it why it doesn't work...
I think the error is somewhere in the birthdaypop,
because i think there should be some sort of php
brackets in between there!? Now it looks like this:
- $g_birthday_pop = <<<EOT
"MM_openBrWindow('../pop-up.php?persoon={array_search($today,
$datum)}','dames3','width=300,height=300')"
EOT;

I'd think that there should be something after persoon= and after
$datum)}
But (of course) <?php ?> doesn't work there.. Please help me out..

Greetings, Krunkelgarten
Jul 17 '05 #9
"krunkelgarten" <kr***********@hotmail.com> wrote in message
news:87**************************@posting.google.c om...
And the title of that page is:
- pop-up.php?persoon={array_search(,%20)}
......
......
Greetings, Krunkelgarten
Sorry my fault, I was typeing the reply, and had to leave, so I closed it
and typed it up again real quick
when I got home.
Again, i tried all of it,
but it still doesn't work;
I changed the datum.php file:
- // January
$datum[Krunkelgarten] = '3-1';

parts should read with quotes
$datum["Krunkelgarten"] = '3-1';

and
"MM_openBrWindow('../pop-up.php?persoon={array_search($today,

$datum)},'dames3','width=300,height=300')"

should be
$g_birthday_pop = "MM_openBrWindow('../pop-up.php?" .
"person=" .
urlencode(array_search($today,$datum)) .
",'dames3','width=300,height=300')";
--
Mike Bradley
http://gzen.myhq.info -- free online php tools
Jul 17 '05 #10
I'm really sorry, but it still doesn't work..
I get an error:
Parse error: parse error in /var/www/html/include/settings.php on line 8

Line 8 looks like this:
urlencode(array_search($today,$datum)) .

I tried it with the "<<<<EOT" part, and without, but it just doesn't work...
:s

Greetings Krunkelgarten
Jul 17 '05 #11
hmm, this worked for me, what does line 7 look like?

--
Mike Bradley
http://gzen.myhq.info -- free online php tools
"krunkelgarten" <kr***********@hotmail.com> wrote in message
news:87**************************@posting.google.c om...
I'm really sorry, but it still doesn't work..
I get an error:
Parse error: parse error in /var/www/html/include/settings.php on line 8

Line 8 looks like this:
urlencode(array_search($today,$datum)) .

I tried it with the "<<<<EOT" part, and without, but it just doesn't work... :s

Greetings Krunkelgarten

Jul 17 '05 #12

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

Similar topics

8
by: Jeroen | last post by:
Hi, I'm searching but not finding :( I need the code that creates automatic the days in a month So like for this month, it creates the days in this format 01-Oct, 02-Oct, .... This...
5
by: Dominique Javet | last post by:
Hello, I'm new to php and mysql and I use Dreamweaver MX 2004, so sorry for this "newbie" question... I've found no answer in the forum ... I've a date problem with my formular. In my mysql DB...
5
by: Greg | last post by:
I have a page that searches a database by a repairman's name and by a date range. It pulls info by the repairman's name but pulls all info in the database regardless of the date. Below is the code...
9
by: newtophp2000 | last post by:
I need to add the ability for the users to select a date on one of our web pages. The examples I was given by some users were in JavaScript. Is there a free date picker that I can use? I saw one...
0
by: oneplace | last post by:
I have the following script that use for the following after i have made my search for a name in my database. I select the name and it bring up this from with all the information of the person. It...
3
by: ClassicNancy | last post by:
I have this mod for my forum and it calls the birthdate from the database. I would like to have it not see the year. What is happening if a person puts a year in the box in their profile it makes it...
0
by: ClassicNancy | last post by:
I have this mod for my forum and it calls the birthdate from the database. I would like to have it not see the year. What is happening if a person puts a year in the box in their profile it makes it...
6
by: ruraldev | last post by:
I have been trying my best to display a chosen date as dd-mm-yyyy but insert it into the mysql database as yyyy-mm-dd, I know it must be simple but no matter what I try I can't get it to work. At...
2
by: Yew12 | last post by:
We are trying to get the following script to display the full date and time. The field we are calling does have both date and time in. Unfortunatly its only returning the date. So I tried putting...
9
by: Mo | last post by:
After a little PHP education, my first project (to get my feet wet) is making an employee time-tracking program for our small business. *** ANY SUGGESTION, THOUGHTS, OR ADVICE WOULD BE WARMLY...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.