f



Get date from text/php-file #2

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.,..
0
12/30/2003 10:04:56 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

11 Replies
1505 Views

Similar Articles

[PageSpeed] 38

"krunkelgarten" <krunkelgarten@hotmail.com> wrote in message
news:8767e62e.0312301404.424614af@posting.google.com...
> 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


0
me1383 (446)
12/30/2003 11:25:03 PM
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
0
12/31/2003 9:58:45 AM
"krunkelgarten" <krunkelgarten@hotmail.com> wrote in message
news:8767e62e.0312310158.1ad1eb1c@posting.google.com...
> 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


0
me1383 (446)
12/31/2003 4:44:38 PM
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
0
1/2/2004 8:22:10 AM
"krunkelgarten" <krunkelgarten@hotmail.com> wrote in message
news:8767e62e.0401020022.9af0d88@posting.google.com...
> 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


0
me1383 (446)
1/2/2004 10:05:29 AM
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=300')"
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
0
1/2/2004 8:40:39 PM
"krunkelgarten" <krunkelgarten@hotmail.com> wrote in message
news:8767e62e.0401021240.5727e5e4@posting.google.com...
> 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=300
')"
> 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


0
me1383 (446)
1/3/2004 6:00:16 AM
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
0
1/3/2004 12:53:07 PM
"krunkelgarten" <krunkelgarten@hotmail.com> wrote in message
news:8767e62e.0401030453.12ea2491@posting.google.com...
> 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


0
me1383 (446)
1/3/2004 9:17:41 PM
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
0
1/4/2004 2:39:29 PM
hmm, this worked for me, what does line 7 look like?

--
Mike Bradley
http://gzen.myhq.info  -- free online php tools
"krunkelgarten" <krunkelgarten@hotmail.com> wrote in message
news:8767e62e.0401040639.424ad107@posting.google.com...
> 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


0
me1383 (446)
1/4/2004 10:04:26 PM
Reply: