Get date from text/php-file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • krunkelgarten

    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.,..
  • CountScubula

    #2
    Re: Get date from text/php-file

    "krunkelgar ten" <krunkelgarten@ hotmail.com> wrote in message
    news:8767e62e.0 312301404.42461 4af@posting.goo gle.com...[color=blue]
    > 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.,..[/color]


    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_openBrWindo w('http://www.nu.nl/script?$n=usern ame','popup','w idth=300,he
    ight=300')"


    --
    Mike Bradley
    http://gzen.myhq.info -- free online php tools


    Comment

    • krunkelgarten

      #3
      Re: Get date from text/php-file

      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

      Comment

      • CountScubula

        #4
        Re: Get date from text/php-file

        "krunkelgar ten" <krunkelgarten@ hotmail.com> wrote in message
        news:8767e62e.0 312310158.1ad1e b1c@posting.goo gle.com...[color=blue]
        > 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[/color]
        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


        Comment

        • krunkelgarten

          #5
          Re: Get date from text/php-file

          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

          Comment

          • CountScubula

            #6
            Re: Get date from text/php-file

            "krunkelgar ten" <krunkelgarten@ hotmail.com> wrote in message
            news:8767e62e.0 401020022.9af0d 88@posting.goog le.com...[color=blue]
            > 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[/color]

            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("popp erson",$person) ;
            then modify the if to read:

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

            --
            Mike Bradley
            http://gzen.myhq.info -- free online php tools


            Comment

            • krunkelgarten

              #7
              Re: Get date from text/php-file

              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($toda y, $datum)) { print
              "onLoad=".$g_bi rthday_pop;}?>

              $g_birthday_pop looks like this:
              $g_birthday_pop = <<<EOT
              "MM_openBrWindo w('../pop-up.php?persoon= test','dames3', 'width=300,heig ht=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

              Comment

              • CountScubula

                #8
                Re: Get date from text/php-file

                "krunkelgar ten" <krunkelgarten@ hotmail.com> wrote in message
                news:8767e62e.0 401021240.5727e 5e4@posting.goo gle.com...[color=blue]
                > Hi Count Scubula,
                >
                > I tried everything what you wrote, but i couldn't get it to work..[/color]
                [color=blue]
                > 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($toda y, $datum)) { print
                > "onLoad=".$g_bi rthday_pop;}?>
                >
                > $g_birthday_pop looks like this:
                > $g_birthday_pop = <<<EOT
                >[/color]
                "MM_openBrWindo w('../pop-up.php?persoon= test','dames3', 'width=300,heig ht=300
                ')"[color=blue]
                > EOT;
                >[/color]

                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
                [color=blue]
                > <?php $today =date("j-n"); if (in_array($toda y, $datum)) { print
                > "onLoad=".$g_bi rthday_pop;}?>
                >
                > $g_birthday_pop looks like this:
                > $g_birthday_pop = <<<EOT
                > "MM_openBrWindo w('../pop-up.php?persoon= {array_search($ today,[/color]
                $datum)},'dames 3','width=300,h eight=300')"[color=blue]
                > EOT;
                >[/color]


                --
                Mike Bradley
                http://gzen.myhq.info -- free online php tools


                Comment

                • krunkelgarten

                  #9
                  Re: Get date from text/php-file

                  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_openBrWindo w('../pop-up.php?persoon= {array_search($ today,
                  $datum)}','dame s3','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

                  Comment

                  • CountScubula

                    #10
                    Re: Get date from text/php-file

                    "krunkelgar ten" <krunkelgarten@ hotmail.com> wrote in message
                    news:8767e62e.0 401030453.12ea2 491@posting.goo gle.com...[color=blue]
                    > And the title of that page is:
                    > - pop-up.php?persoon= {array_search(, %20)}
                    > ......
                    > ......
                    > Greetings, Krunkelgarten[/color]

                    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.
                    [color=blue]
                    > Again, i tried all of it,
                    > but it still doesn't work;
                    > I changed the datum.php file:
                    > - // January
                    > $datum[Krunkelgarten] = '3-1';
                    >[/color]

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

                    and
                    [color=blue]
                    > "MM_openBrWindo w('../pop-up.php?persoon= {array_search($ today,[/color]
                    $datum)},'dames 3','width=300,h eight=300')"

                    should be
                    $g_birthday_pop = "MM_openBrWindo w('../pop-up.php?" .
                    "person=" .
                    urlencode(array _search($today, $datum)) .
                    ",'dames3','wid th=300,height=3 00')";


                    --
                    Mike Bradley
                    http://gzen.myhq.info -- free online php tools


                    Comment

                    • krunkelgarten

                      #11
                      Re: Get date from text/php-file

                      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

                      Comment

                      • CountScubula

                        #12
                        Re: Get date from text/php-file

                        hmm, this worked for me, what does line 7 look like?

                        --
                        Mike Bradley
                        http://gzen.myhq.info -- free online php tools
                        "krunkelgar ten" <krunkelgarten@ hotmail.com> wrote in message
                        news:8767e62e.0 401040639.424ad 107@posting.goo gle.com...[color=blue]
                        > 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[/color]
                        work...[color=blue]
                        > :s
                        >
                        > Greetings Krunkelgarten[/color]


                        Comment

                        Working...