+ Reply to Thread
Results 1 to 8 of 8

Thread: template question for the pros

  1. #1
    Senior Member doron is on a distinguished road
    Join Date
    Apr 2000
    Location
    Austin, TX
    Age
    29
    Posts
    670
    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

  2. #2
    Member customcpu is on a distinguished road customcpu's Avatar
    Join Date
    Jun 2000
    Posts
    93
    Actually in PHP
    Code:
     ++$a
    is the same as
    Code:
     $a++

  3. #3
    Member customcpu is on a distinguished road customcpu's Avatar
    Join Date
    Jun 2000
    Posts
    93
    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

  4. #4
    Senior Member doron is on a distinguished road
    Join Date
    Apr 2000
    Location
    Austin, TX
    Age
    29
    Posts
    670
    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?

  5. #5
    Member customcpu is on a distinguished road customcpu's Avatar
    Join Date
    Jun 2000
    Posts
    93
    .= appends while = does not. For example:
    Code:
    $a = "hello ";
    $a = "world";  // $a is world
    while
    Code:
    $a = "hello ";
    $a .= "world"; // $a is hello world

  6. #6
    vBulletin Developer Freddie Bingham is just really nice Freddie Bingham is just really nice Freddie Bingham is just really nice Freddie Bingham is just really nice Freddie Bingham is just really nice Freddie Bingham's Avatar
    Join Date
    May 2000
    Location
    California
    Age
    35
    Posts
    13,941
    Blog Entries
    16
    .= seems to be the equivalent to += in C. I need to look up why they felt the need to use a . to denote addition.
    vBulletin Developer since Dec 2000

  7. #7
    New Member aritus is on a distinguished road
    Join Date
    Jul 2000
    Location
    Thailand
    Posts
    4

    ?? 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

  8. #8
    Senior Member doron is on a distinguished road
    Join Date
    Apr 2000
    Location
    Austin, TX
    Age
    29
    Posts
    670
    a template defines how the page looks like. this means you can alter the look without hacking at the codebase.

+ Reply to Thread

Similar Threads

  1. Help me pros ...
    By Neo-Cloud in forum vBulletin 2 'How Do I' and Troubleshooting
    Replies: 17
    Last Post: Tue 21st May '02, 8:43pm
  2. Quick little question for the pros
    By PimpDaddy1 in forum vBulletin 2 'How Do I' and Troubleshooting
    Replies: 3
    Last Post: Wed 11th Apr '01, 7:26pm
  3. Time For A Pros Help
    By glenv in forum vBulletin Templates, Graphics & Styles
    Replies: 0
    Last Post: Sun 25th Mar '01, 9:39am

Bookmarks

Posting Permissions

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts