Announcement

Collapse
No announcement yet.

variable within a variable

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

  • Strat1979
    replied
    Thanks dcarver,

    Tried it but the same error.

    Leave a comment:


  • dcarver
    replied
    What if you tried something like this?

    Code:
    <mvt:eval expr="l.settings:subcats[g.number]:code" />

    Leave a comment:


  • Matt Zimmermann
    replied
    It looks like, at this time, without using something like Tool Belt, Miva will not render a variable within a variable like you are trying to do. You can see an example of how to use the assign function in Tool Belt here, see example 4 http://www.pcinet.com/p/toolbelt_docs.html#Assign

    Leave a comment:


  • Strat1979
    replied
    I am using it in a ReadyTheme Product Listing (carousel).
    I have also tried it on the footer of a category page.
    In both cases I do get a value for &mvt:global:number;

    Leave a comment:


  • Matt Zimmermann
    replied
    Are you using this within a Tool Kit function or is it just for displaying the particular code?

    Leave a comment:


  • Strat1979
    replied
    <mvt:item name="toolkit" param="vrandom|number|l.all_settings:subcat_count" />
    &mvt:global:number;
    <br>
    &mvt:subcats[&mvt:global:number;]:code;

    Leave a comment:


  • Matt Zimmermann
    replied
    Can you post the function you are passing the global number into?

    Leave a comment:


  • Strat1979
    replied
    It is outputting.
    &mvt:global:number; does show a number value.

    Leave a comment:


  • Matt Zimmermann
    replied
    Check to make sure that &mvt:global:number; is outputting. If it isn't, you may need to check the variable being used to generate the random number.

    Leave a comment:


  • Strat1979
    replied
    Hi Matt,

    Thank you for the response.
    Yes, I had already tried that. Here is the error message:
    Fatal error in mm5/5.00/templates/s01/c51-footer.mvc @ [00000002:0000005c]: modules/component/cmp-cssui-pchdft.mv: Line 4: Array index must be positive integer

    Leave a comment:


  • Matt Zimmermann
    replied
    When using Tool Kit in this way, 'number' is a global variable. Try this as your token:
    Code:
    &mvt:subcats[&mvt:global:number;]:code;

    Leave a comment:


  • Strat1979
    started a topic variable within a variable

    variable within a variable

    Is it possible to use a variable within a variable?

    For instance, in this token, &mvt:subcats[18]:code; I would like to use a variable for the number (in this case 18).

    So, is it possible to have it function like: &mvt:subcats[number]:code;

    Using toolkit, I created a random number variable and tried using it like this:
    <mvt:item name="toolkit" param="vrandom|number|l.all_settings:subcat_count" />
    &mvt:subcats[number]:code;

    However, no go.

    Is there a way to do this?

    Thanks.






Working...
X