Announcement

Collapse
No announcement yet.

Global Variables: How to show and evaluate?

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

    Global Variables: How to show and evaluate?

    Hi there, Everyone:

    Trying to figure how to use some global variable that are supposed to be generated by the Viking Coders Affiliate Manager module. According to James at emdeia, it apparently sets some global variables. He gave some examples like the following:

    <MvASSIGN NAME="g.AffiliateData:code" VALUE="{AffiliateData.d.code}">
    <MvASSIGN NAME="g.AffiliateData:id" VALUE="{AffiliateData.d.affiliate}">
    <MvASSIGN NAME="g.AffiliateData:fname" VALUE="{AffiliateData.d.fname}">
    <MvASSIGN NAME="g.AffiliateData:lname" VALUE="{AffiliateData.d.lname}">

    So how do we display something like the Affiliate Code (the first one listed in the above)? I thought to display it we would just use something like this:

    &mvte:global:AffiliateData.d.code;

    and I thought to evaluate it, we would just use something like this:

    <mvt:if expr="(g.Affiliate.Data.d.code EQ 'news')">
    This is a conditional
    </mvt:if>

    But that doesn't seem to be working, so I think there might be something wrong with my SMT.

    Thanks in advance for any help.
    Mark Romero
    ~~~~~~~~

    #2
    Re: Global Variables: How to show and evaluate?

    g.AffiliateData:code, id, fname and lname are the variables. So it should look something like:

    Code:
    <mvt:if expr="(g.AffiliateData:code EQ 'news')">

    Comment


      #3
      Re: Global Variables: How to show and evaluate?

      Thank you, Dan:

      so if I just wanted to display the variable, would I use this format:

      &mvte:global:AffiliateData.d.code;

      Or is that wrong?
      Mark Romero
      ~~~~~~~~

      Comment


        #4
        Re: Global Variables: How to show and evaluate?

        The rule of thumb is that you close the database unless you are specifically skipping through records and reading data. When you see a variable with .d. in it, that is a database variable. Most of the time the database is only open for an instant so that variable may not exist at the point you are doing the display of it. So if it is blank, that would be why. On the other hand, in Dan's example he is using g.AffiliateData:code which is a global variable that exists as long as the page is being rendered. The viking module probably creates that variable with the line <MvASSIGN NAME="g.AffiliateData:code" VALUE="{AffiliateData.d.code}"> inside the module code.
        Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
        Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
        Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
        Facebook http://www.facebook.com/EmporiumPlus
        Twitter http://twitter.com/emporiumplus

        Comment


          #5
          Re: Global Variables: How to show and evaluate?

          Thank You, Bill:

          Could I ask then how I would simply display that g.AffiliateData:code variable then?

          Would I have to do something like this:

          &mvte:g.AffiliateData:code;

          Or is that wrong, too?

          thanks in advance. I appreciate all the help you provide in these forums.

          (And thanks to Bruce of Phosphor Media for the P/M).
          Last edited by Siamese-Dream.Com; 12-04-10, 12:20 PM.
          Mark Romero
          ~~~~~~~~

          Comment


            #6
            Re: Global Variables: How to show and evaluate?

            &mvte:global:AffiliateData:code;

            When you do &mvte you spell out global. When you do the <mvt:if expr="g.AffiliateData:code..... you don't spell out the global. You just put g.
            Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
            Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
            Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
            Facebook http://www.facebook.com/EmporiumPlus
            Twitter http://twitter.com/emporiumplus

            Comment


              #7
              Re: Global Variables: How to show and evaluate?

              Thank You, Bill :) :) :)
              Mark Romero
              ~~~~~~~~

              Comment

              Working...
              X