Announcement

Collapse
No announcement yet.

Variable Calculations

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

    Variable Calculations

    Hi all,

    does anyone know if in V8 I can create variables 'a', 'b' and 'c'. Then use variables 'a' and 'b' to calculate 'c'?

    Many thanks
    Sally
    fashion jewellery and hair accessories
    Regards
    Sally

    Fashion Jewellery Wholesale - Glitzy Jewels

    #2
    id' perhaps use javascript, the the resultant 'c' is not for the search engines.

    put your variables into a javascript function and let it then display 'c' based upon it.

    Comment


      #3
      Actinic can do this using built-in PHP interpreter. However it cannot set the value of a Variable - just use it. E.g. a and b are non-blank number variables (3 and 4). Then
      Code:
      <actinic:block php="true">
      // display hypotenuse of right triangle
      $a = <actinic:variable name="a" encoding="perl" selectable="false" />;
      $b = <actinic:variable name="b" encoding="perl" selectable="false" />;
      $c = sqrt(($a * $a) + ($b * $b));
      echo "Sides are $a and $b - hypotenuse is $c";
      </actinic:block>
      And the line Sides are 3 and 4 - hypotenuse is 5 will become part of your static HTML pages, which search engines will happily read.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        thanks for the replies

        Norman - from what your saying I cant set the final variable with the contents of the calculation. Is this the case?

        Gabriel - will the javascript solution going to present the same problem.


        Many thanks
        Sally
        hair accessories and fashion jewellery
        Regards
        Sally

        Fashion Jewellery Wholesale - Glitzy Jewels

        Comment


          #5
          That's right. Variables are basically read only at page generation time. You can access their values but can't change them other than via the Actinic dialogue boxes.

          However you can put the lump of code above into a custom Layout and insert it wherever you want the calculation displayed.

          Also with PHP you can set a PHP variable ($myvar = 'whatever' within a PHP block and use that calculated value in another PHP block (echo $myvar anywhere lower on the page. So if you set something in the head of your Overall Layout it should be available on any page that descends from that layout.

          Experiment a little and see what happens.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment

          Working...
          X