template question for the pros

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • doron
    Senior Member
    • Apr 2000
    • 669

    template question for the pros

    on working for the poll hack, I got stuck on this:

    In order to let the user define the number of options, I use 2 templates:

    newpoll:
    <smallfont>Remember to keep the poll options short and to the point</smallfont>

    <BR>

    <TABLE WIDTH="100%" CELLPADING="0" CELLSPACING="2" BGCOLOR="#FFFFFF">

    $pollnewbit

    </TABLE>
    and newpollbit:

    <TR>
    <TD><normalfont>Option $run:</normalfont></TD>
    <TD><INPUT NAME="Option$run" TYPE="TEXT" sIZE="45"></TD>
    </TR>
    Now, I want to call newpoll once and newpollbit x times. The following code however, only gives me once newpollbit:

    for ($run=1; $run < $PollNum; ++$run){
    eval("\$pollnewbit = \"".gettemplate("pollnewbit")."\";");
    }
    eval("\$pollnew = \"".gettemplate("pollnew")."\";");
    What am I doing wrong? Probably something stupid
  • customcpu
    Member
    • Jun 2000
    • 94

    #2
    Actually in PHP
    Code:
     ++$a
    is the same as
    Code:
     $a++
    Interested in Linux?
    Have a question?
    http://www.linuxquestions.org

    Comment

    • customcpu
      Member
      • Jun 2000
      • 94

      #3
      Almost forgot... There IS a difference between the two - just not in the context that was asked.
      Code:
      $a = 10;       // $a is 10
      $b = $a++;     // $a is 11, but $b is 10 (The assignment occued before the incrementation)
      but
      Code:
      $a = 10;       // $a is 10
      $b = ++$a;     // $a and $b are both 11 (The assignment occured after the incrementation
      Interested in Linux?
      Have a question?
      http://www.linuxquestions.org

      Comment

      • doron
        Senior Member
        • Apr 2000
        • 669

        #4
        I solved it myself. should be

        for ($run=1; $run < $PollNum; $run++){
        eval("\$pollnewbit .= \"".gettemplate("pollnewbit")."\";");
        }
        anyone know the full meaning of .= in comparison to just a = in templates?

        Comment

        • customcpu
          Member
          • Jun 2000
          • 94

          #5
          .= appends while = does not. For example:
          Code:
          $a = "hello ";
          $a = "world";  // $a is world
          while
          Code:
          $a = "hello ";
          $a .= "world"; // $a is hello world
          Interested in Linux?
          Have a question?
          http://www.linuxquestions.org

          Comment

          • Freddie Bingham
            Former vBulletin Developer
            • May 2000
            • 14057
            • 1.1.x

            #6
            .= seems to be the equivalent to += in C. I need to look up why they felt the need to use a . to denote addition.

            Comment

            • aritus
              New Member
              • Jul 2000
              • 4

              #7
              ?? what is template in vb ??

              sorry for my stupid question , but idon'n know and really would like to khow about vb template.
              what is and wheeis vb template?
              thanks

              Comment

              • doron
                Senior Member
                • Apr 2000
                • 669

                #8
                a template defines how the page looks like. this means you can alter the look without hacking at the codebase.

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...