Announcement

Collapse
No announcement yet.

How to create a custom system variable

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

    How to create a custom system variable

    Is it possible to create a custom system variable that can be used in any page template?

    #2
    What is your use case?

    The closest thing would be a cookie or a custom page field that you render globally in the head tag so its available everywhere.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      I'm just wondering if you mean a global variable versus a system variable as they have different scope and availability?

      Brennan - Can he create system variables from global headers, htaccess or miva_config?


      http://www.alphabetsigns.com/

      Comment


        #4
        Thanks the responses. I was looking for a way to remove a repetitive IF statement. Rendering a global variable in the head tag doesn't work because I need to call this before the global header is called.

        Code:
        <mvt:if expr="s.http_host EQ 'www.domain.com'">
             <mvt:assign name="l.useURL" value="'https://www.otherDomain.com/miva/'" />
        <mvt:else>
             <mvt:assign name="l.useURL" value="'https://dev.otherDomain.com/miva/'" />
        </mvt:if>
        
        <mvt:call ACTION="l.useURL $ 'template/' $ l.settings:page:code $ '/' $ g.objectId" METHOD="'GET'">
             <mvt:assign name="g.jsonData" value="s.callvalue" />
        </mvt:call>

        Comment


          #5
          Code:
          <mvt:assign name="g.http_host" value="s.http_host" />
          <mvt:if expr="g.http_host EQ 'www.domain.com'">
               <mvt:assign name="l.useURL" value="'https://www.otherDomain.com/miva/'" />
          <mvt:else>
              <mvt:assign name="l.useURL" value="'https://dev.otherDomain.com/miva/'" />
          </mvt:if>
          
          <mvt:call ACTION="l.useURL $ 'template/' $ l.settings:page:code $ '/' $ g.objectId" METHOD="'GET'">
          <mvt:assign name="g.jsonData" value="g.jsonData $ s.callvalue" />
          </mvt:call>
          I'm guessing that you have to use global scope in the IF statement. Also the s.callvalue streams so you have to concatenate it. Then use miva_json_decode() .
          http://www.alphabetsigns.com/

          Comment


            #6
            and use the HTML Profile section for stuff like this, just make sure if AFTER the doctype.
            the Head template, <head> gets appended with a bunch of stuff before the Head Template is rendered.
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment

            Working...
            X