Announcement

Collapse
No announcement yet.

Today() type variable?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Today() type variable?

    Hi,

    Is there a todaysdate variable in actinic? I did a search for date and today and day etc but couldnt find anything. I need it for a "new" logo I want to put in a IF Block.

    Thanks,
    Paul.

    #2
    The inbuilt PHP will do this. It will generate the time at which the page was created by Actinic.
    Code:
    <actinic:block php="true" >
    // Assuming today is: March 10th, 2001, 5:16:18 pm
    $today = date("m.d.y");                         // 03.10.01
    $today = date("j, n, Y");                       // 10, 3, 2001
    $today = date("Ymd");                           // 20010310
    $today = date('h-i-s, j-m-y, it is w Day z ');  // 05-16-17, 10-03-01, 1631 1618 6 Fripm01
    $today = date('\i\t \i\s \t\h\e jS \d\a\y.');   // It is the 10th day.
    $today = date("D M j G:i:s T Y");               // Sat Mar 10 15:16:08 MST 2001
    $today = date('H:m:s \m \i\s\ \m\o\n\t\h');     // 17:03:17 m is month
    $today = date("H:i:s");                         // 17:16:17
    $today = date("F j, Y, g:i a");                 // March 10, 2001, 5:16 pm
    echo $today;
    </actinic:block>
    Delete all the $today = ... lines except the one you want.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Hi Norman,

      php is something new to me. How would I use that in a Block IF statement? In psuedo code this what I want is:

      If "Product_EnterDate" - "Today()" Less than "30" then
      Display New Logo
      End If

      Is php run when actinic creates the page or is it something that is done on the server like perl/ssi?

      Thanks,
      Paul.

      Comment


        #4
        I don't know what you mean by If "Product_EnterDate". Is this a Variable or what?
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Sorry, yep its a variable I have set up that I enter against the product when I set that product up. I was then going to take the current date away from the date in the variable and if the difference is less than say 30 days then the New image would be shown.

          Thanks,
          Paul.

          Comment


            #6
            OK. Then a lot depends on how you put the date into that variable. If you've used yy-mm-dd you'll have to do something to turn that into a number. Chop it up and do something like (yy * 365) + (mm * 31) + dd.

            Now do a similar thing with the

            $today = date("y-m-d");

            and compare the two numbers. You can get the PHP manual from http://www.php.net/docs.php

            Code:
            <actinic:block php="true" >
            $today = date("y-m-d");
            $entered = '<Actinic:Variable Name="Product_EnterDate" encoding="perl" selectable="false" />';
            echo "Today: $today  Entered: $entered"; // test to see what the data looks lke
            // learn PHP and compare here
            <actinic:block>
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Another thing to note is that this is only useful if you regularly update your site. The PHP is running on the Actinic PC and will only generate this code on Update / Refreshes.

              If you want to leave the site unaltered for long periods of time you should use JavaScript embedded in the Product Layout. This will get the time from the customers PC and will always stay up to date.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment

              Working...
              X