Re: Get date from text/php-file
krunkelgarten wrote:[color=blue]
> What i have is the script for the pop-up:[/color]
[color=blue]
> <body scroll="auto" <?php $today =date("d-F"); if ($today==$datum )
> {echo "onLoad=".$g_bi rthday_pop;}?>>[/color]
[color=blue]
> The pop-script =
> $g_birthday_pop = <<<EOT
> "MM_openBrWindo w('http://www.nu.nl','pop up','width=300, height=300')"
> EOT;[/color]
[color=blue]
> $datum is in another file (include/datum.php):
> <?php
> $datum = "30-December";
> ?>[/color]
[color=blue]
> And this works if the date is 30th of December,
> but i want it too on other dates that you put in $datum[/color]
[color=blue]
> So i want to control the pop-up just by editing the "datum.php"-file[/color]
I'd do it with arrays:
in the included file put dates to check in one array
<?php
$datum[] = '30-December';
$datum[] = '10-March';
// ...
?>
and substitute your if ($today==$datum ) with
if (in_array($toda y, $datum))
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Get date from text/php-file
Collapse
This topic is closed.
X
X
-
Guest replied -
Guest repliedRe: Get date from text/php-file
krunkelgarten escribió:[color=blue]
> Hi there,
>
> I'm new to PHP, and i want to create a pop-up (on page load) on certain dates..
> What i have is the script for the pop-up:
>
> <body scroll="auto" <?php $today =date("d-F"); if ($today==$datum )
> {echo "onLoad=".$g_bi rthday_pop;}?>>
>
> The pop-script =
> $g_birthday_pop = <<<EOT
> "MM_openBrWindo w('http://www.nu.nl','pop up','width=300, height=300')"
> EOT;
>
> $datum is in another file (include/datum.php):
> <?php
> $datum = "30-December";
> ?>
>
> And this works if the date is 30th of December,
> but i want it too on other dates that you put in $datum
> Something like:
> <?php
> $datum = "30-December";"10-March";
> ?>
> So i want to control the pop-up just by editing the "datum.php"-file
>
> Thanks in advance,
>
> Greetings Krunkelgarten[/color]
I would make $datum an array variable, for example:
<?php
$datum = array()
$datum[] = "30-December";
$datum[] = "10-March";
?>
And then in your layout PHP check if today date is on the $datum array.
Regards,
knocte
Leave a comment:
-
Get date from text/php-file
Hi there,
I'm new to PHP, and i want to create a pop-up (on page load) on certain dates..
What i have is the script for the pop-up:
<body scroll="auto" <?php $today =date("d-F"); if ($today==$datum )
{echo "onLoad=".$g_bi rthday_pop;}?>>
The pop-script =
$g_birthday_pop = <<<EOT
"MM_openBrWindo w('http://www.nu.nl','pop up','width=300, height=300')"
EOT;
$datum is in another file (include/datum.php):
<?php
$datum = "30-December";
?>
And this works if the date is 30th of December,
but i want it too on other dates that you put in $datum
Something like:
<?php
$datum = "30-December";"10-March";
?>
So i want to control the pop-up just by editing the "datum.php"-file
Thanks in advance,
Greetings Krunkelgarten
Tags: None
Leave a comment: