Help with Smarty

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Freebird

    Help with Smarty

    Hello you all, =]


    I've a smarty var, like this:
    {$var}
    that is equal to: ttttttttttttt|z zzzzzzzzzzz

    It can be any size, the important is that they are separated by the '|'

    How do I 'explode' that into an array or 2 variables in the smarty template
    ?

    So I can just use:
    {$var[0]} = ttttttttttttt;
    {$var[0]} = zzzzzzzzzzzz;

    Tks in advance

    Freebird


  • Hal Rosser

    #2
    Re: Help with Smarty


    "Freebird" <peoplel@hotmai l.com> wrote in message
    news:dm318e$7vm $1@domitilla.ai oe.org...[color=blue]
    > Hello you all, =]
    >
    >
    > I've a smarty var, like this:
    > {$var}
    > that is equal to: ttttttttttttt|z zzzzzzzzzzz
    >
    > It can be any size, the important is that they are separated by the '|'
    >
    > How do I 'explode' that into an array or 2 variables in the smarty[/color]
    template[color=blue]
    > ?
    >
    > So I can just use:
    > {$var[0]} = ttttttttttttt;
    > {$var[0]} = zzzzzzzzzzzz;
    >
    > Tks in advance
    >
    > Freebird[/color]

    Try explode( ) like this:
    $pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
    $pieces = explode(" ", $pizza);
    echo $pieces[0]; // piece1
    echo $pieces[1]; // piece2
    *** reference: http://us2.php.net/manual/en/function.explode.php


    Comment

    • Freebird

      #3
      Re: Help with Smarty

      HERE'S MY QUESTION:

      I've a smarty var, like this:
      {$var}
      that is equal to: ttttttttttttt|z zzzzzzzzzzz

      It can be any size, the important is that they are separated by the '|'

      How do I 'explode' that into an array or 2 variables in the smarty template
      ?

      So I can just use:
      {$var[0]} = ttttttttttttt;
      {$var[0]} = zzzzzzzzzzzz;


      HERE'S YOUR ANSWER,

      [color=blue]
      > Try explode( ) like this:
      > $pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
      > $pieces = explode(" ", $pizza);
      > echo $pieces[0]; // piece1
      > echo $pieces[1]; // piece2
      > *** reference: http://us2.php.net/manual/en/function.explode.php[/color]

      DO YOU READ THE MESSAGES BEFORE YOU ANSWER THEM ?
      DO YOU THINK I DON'T KNOW HOW TO USE EXPLODE ?
      I WAS REALLY CLEAR, TAKE IT A LOOK AT THE QUESTION ABOVE, I NEED TO THAT
      WITHIN SMARTY TEMPLATES, GET IT ?
      INSIDE SMARTY TEMPLATES, SMARTY !


      TKS


      Freebird



      Comment

      Working...