Announcement

Collapse
No announcement yet.

php calculation - help!

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

    php calculation - help!

    Ive got the following:

    <actinic:block php="true" >
    $ih = "<actinic:variable name="productimageheight">"; ////thats 240
    $iw = "<actinic:variable name="ProductImageWidth" />"; /////thats 480
    $ih = trim($ih); //remove trailing spaces
    $iw = trim($iw);
    $num = $ih/$iw;
    echo $num;
    </actinic:block>

    and i get div 0 error....
    if i echo $ih or $iw, i get their values correctly - i'm guessing they are still text so i tried (float)$ih and i tried (int)$ih but every time I get an error...

    what stupid error am i making??

    help pleeeease chaps/chapesses!
    Andy Warner

    www.legendgames.co.uk - rpgs, boardgames, dice and other geeky stuff
    www.RPGMiniatures.com D&D and Star Wars Miniatures

    Both running the Cart from Search Page hack

    Also www.mainlymurder.co.uk www.thegamesplace.co.uk and www.thediceplace.co.uk

    All running V8.5.2 Multisite on a windows 7 quad PC, augmented by Mole End automation, from a single shared database, using actinic specific hosting from Host-IT.

    #2
    You've forgot the closing / in the first variable. And there's no need to treat these as strings. Also add selectable="false" to your variables so they work on the Design tab.

    Try
    Code:
    <actinic:block php="true" >
    $ih = <actinic:variable name="ProductImageHeight" selectable="false" />; ///// thats 240
    $iw = <actinic:variable name="ProductImageWidth" selectable="false" />; ///// thats 480
    $num = $ih/$iw;
    echo $num;
    </actinic:block>
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      just that pesky trailing / and =false...

      thankyou Norman, I really do appreciate it - works as it should now!
      Andy Warner

      www.legendgames.co.uk - rpgs, boardgames, dice and other geeky stuff
      www.RPGMiniatures.com D&D and Star Wars Miniatures

      Both running the Cart from Search Page hack

      Also www.mainlymurder.co.uk www.thegamesplace.co.uk and www.thediceplace.co.uk

      All running V8.5.2 Multisite on a windows 7 quad PC, augmented by Mole End automation, from a single shared database, using actinic specific hosting from Host-IT.

      Comment

      Working...
      X