Announcement

Collapse
No announcement yet.

wishlist: relational variables

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

    wishlist: relational variables

    Hi,

    If this is possible already, let me know.

    Paul.
    ---
    Relational Variables:
    You have a variable, say "Brand" that you can assign other variables to, e.g. Logo, Url, ID, Phone etc etc. When you select that variable in code, all the subvariables come available. Here is an example.

    Main:- Brand (Jux Jewellery)
    Sub:- Logo (juxlogo.jpg)
    Sub:- Url (www.juxjewellery.co.uk)
    Sub:- OurUrl (jux-jewellery.php)
    Sub:- Description (jux do silver jewellery)
    Sub:- DesignerName (mrs. jux)

    Usage, In Properties you select the brand (or whatever). In Code you use it like:

    Brand (results in "Jux Jewellery"
    Brand.Logo (results in juxlogo.jpg)
    Brand.OurURL (results in juxjewellery.php)
    etc

    Why? This would make it much easier to set up one time info and reference it all over the place. At the moment you either have to have a lot of different variables to select for each product etc or you have to have lots of "block ifs" (e.g. if brand=jux then show this logo etc).

    #2
    You might be able to use content categories for this. For example, in 'Design | Content Categories' you create one content category for each brand you have available. Then for your variables (eg 'Description', 'DesignerName' etc.) you can use 'list of choices' rather than 'Text'. Once you have done that, you can use the 'Advanced Place of Settings' tab in a variable to limit certain options to certain content categories.

    That way, you should just be able to set the Category of a product, and it will set all the variable values automatically.

    I must admit, I haven't tested this, but it is worth experimenting with to see if it gets you further down the line.

    Comment


      #3
      The built-in PHP can help with this.

      You could put code like into C:\Program Files\Actinic v8\actinic_main.php

      Code:
      $brands["acme"] = array("longname"	=> "Acme corporation",
      			"email"		=> "info@acme.org",
      			"logo"		=> "acmelogo.jpg",
      			"description"	=> "Acme is the main supplier to the road-runner."
      			); 
      					
      $brands["wowza"] = array("longname"	=> "Wowza corporation",
      			"email"		=> "info@wowza.com",
      			"logo"		=> "wowzamainlogo.jpg",
      			"description"	=> "Wowza is the worlds leading supplier of widgets."
      			);
      Then create a variable called Brand which you will use to contain values like Acme, Wowza, etc

      Finally you could use a layout called "BrandName" containing

      Code:
      <actinic:block php="true">
      $thisbrand = <actinic:variable name="Brand" encoding="perl" selectable="false"/>
      if (isset($brands[$thisbrand])) $echo $brands[$thisbrand]["longname"];
      </actinic:block>
      and for the email a layout called BrandEmail would be a one word change

      Code:
      <actinic:block php="true">
      $thisbrand = <actinic:variable name="Brand" encoding="perl" selectable="false"/>
      if (isset($brands[$thisbrand])) $echo $brands[$thisbrand]["email"];
      </actinic:block>
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Cool! Thanks norman, I am off to try this.

        php is very cool, but its taking me a little to get it learnt!

        Thanks,
        Paul.

        Comment


          #5
          A few notes.

          That PHP isn't tested.

          If you run several sites, you may prefer to put the Array code into your Overall Layout (in the HEAD section, say).

          This is because C:\Program Files\Actinic v8\actinic_main.php is common to all Actinic installations and not local to a specific site.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment

          Working...
          X