Announcement

Collapse
No announcement yet.

Using custom variable/properties outside actinic

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

    Using custom variable/properties outside actinic

    I want to be able to look up an image name -set as a custom property in Actinic, from outside the acatalog folder.

    We have a blog - using wordpress - (www.rooturl/blog) and when a image in the header, not the logo, is changed in Actinic I want the blog to automatically pick it up as well by accessing the file name from Actinic Variables - the variable is called "TopMenuImage" and contains a filename.

    I found some posts on this in the forum but could not relate/fully understand them.
    David Cunningham

    www.truska.com
    -----------------------------
    ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

    #2
    I presume that this is so that you can duplicate the image change in the wordpress site as per it changes in the Actinic site?

    If so, then maybe the best way would be to create a brand new layout in Actinic as a popup layout, include the Actinic variable within this layout along with its usual <img src="variable">, so that the file contains just the image code, then set Actinic to upload this separate file each time the site uploads.

    Within your wordpress site use a php include to include the content of this Actinic maintained file.

    Comment


      #3
      Would the simplest way not simply be to reference a specific image file in your Actinic website

      e.g. (in the blog site)
      <img src="http://www.yourdomain.com/acatalog/imageheader.jpg" />

      and then simply rename the required header image to "imageheader.jpg" in Actinic and update the website?

      One other way to do it dynamically would require the creating of a javascript file/function which, when called, returned the HTML for the image required.
      This would use PHP in Actinic to create the file employing the variable to do so.
      It would then need to be uploaded (additional files) and then the blog image source would then need to link to that file
      e.g.
      (on blog site)
      <img src="http://www.yourdomain.com/acatalog/yourJavascripFile.js" />


      Hope these options make sense.
      There will be lots of other was as well....
      Fergus Weir - teclan ltd
      Ecommerce Digital Marketing

      SellerDeck Responsive Web Design

      SellerDeck Hosting
      SellerDeck Digital Marketing

      Comment


        #4
        Thank you both I-CC and fergusw for such fast responses
        yes it is just to keep the image in sync with actinic.

        renaming is an option and will work fine but - but client has several images that they use as well as creating new once and it is just so easy to pick the one from sites 1 folder rather than renaming and making sure you have the original with another name etc. I can see them forgetting to rename one and losing it.

        Hense looking to see if I can read it from actinic into blog file.

        The idea of a popup layout not sued anywhere else that just holds the image link sounds the easiest solution - so I will give it a whirl initially.

        Many thanks again for such speed and quality of response.
        David Cunningham

        www.truska.com
        -----------------------------
        ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

        Comment


          #5
          Heres another idea which is probably easier to implement:

          Create a new layout and selector and have it only be used say in the search page or some page where it will only be executed once.

          Within the layout add:

          Code:
          <actinic:block php="true">
          $html01 =  '<img src="<actinic:variable name="TopMenuImage" />"/>';
          if ( ! $file01 = fopen('Changing-Image.txt', 'w') ) {echo 'Error opening Changing-Image.txt';exit;}
          if ( ! fwrite($file01, $html01) ) {echo 'Error writing Changing-Image.txt';exit;}
          fclose($file01);
          </actinic:block>
          This will create a file in your site folder called Changing-Image.txt (you may need to add the full URL into the src 'http:// etc etc'.

          Generate the site once so that the file is created and check the resultant content meets your needs. Add it to additional files to upload then add this to your wordpress theme using php include and it will pull the file each time the wordpress page is shown and Actinic maintains it for you using the variable alone.

          Comment


            #6
            That is even better - did a wee test on a local site here and seemed fine - will implement on client site when I can get access again.
            Very clever and simple way to achieve this
            Thanks again I-CC
            David Cunningham

            www.truska.com
            -----------------------------
            ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

            Comment


              #7
              You can even do this without using any Actinic PHP to write the file.

              Actinic has a Layout Type of "Popup" that can create a file (it's used to create the Extended Info popup page but can be used to create any other type of file).

              Right-click the top of the Library and select New Layout Type. Name it e.g. VariableToFile and set Layouts to Popup.

              Right-click VariableToFile, choose New Layout and name it Variable To File. Into that layout put:
              Code:
              <img src="<actinic:variable name="TopMenuImage" />" />
              Click the Edit Layout Detail button and change Extended Info Page File Name to be Changing-Image.txt. OK out.

              Right-click the VariableToFile group and choose New Selector. Name it VariableToFile, open it and in the Values tab, move layout Variable To File to the Layouts Offered... field.

              Now put something into your Overall Layout like:
              Code:
              <actinic:block if="%3cactinic%3avariable%20name%3d%22IsBrochureHomePage%22%20%2f%3e">
              	<actinic:variable name="VariableToFile" />
              </actinic:block>
              So it's only executed once when building the site.

              The powerful bit about this tweak is that the file gets uploaded for you, you could put lots of layouts/variables/HTML into the Layout that generates the file, and you could use variables or a calculation in the Extended Info Page File Name field to create lots of files.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                And the weirdest way to create a file containing a Variable.
                Create a file in your Site folder called Changing-Image.css. In it put:
                Code:
                <img src="<actinic:variable name="TopMenuImage" />" />
                Put this into your Overall Layout (in the HEAD):
                Code:
                <script>/*<link href="Changing-Image.css" rel="stylesheet" type="text/css">*/</script>
                Now include file Changing-Image.css as before. The .css bit should be ignored and we'll just get the embedded IMG tag HTML.

                The weirdness is that external files of type .css are parsed by Actinic. We activate the CSS link tag by putting it within comments within SCRIPT tags so nothing is loaded or added to the page. Actinic only parses .css files once so we don't seem to need a BlockIf around it.
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment

                Working...
                X