ตัวอย่าง parser ใน template

กระทู้จากหมวด 'Wiki Talk' โดย jpenguin, 30 กรกฎาคม 2011.

  1. jpenguin

    jpenguin Admin Staff Member

    EXP:
    2,537
    ถูกใจที่ได้รับ:
    93
    คะแนน Trophy:
    113
    อันนี้ผมขอจดเป็นโน้ตไว้เฉยๆ นะครับ ไว้ผมใช้คล่องๆ แล้วจะมาอธิบายให้อีกที

    IF only.... =, ==, ===, !=, !==, <, >, <=, >=
    it will also process else with [else] or [else/], but you can not do nested ifs.

    Code:
    [if={{{grd}}}===0]neutral[else]string[/if]
    [if={{{grd}}}>0]positive[/if]
    [if={{{grd}}}<0]negative[/if]
    ตัวอย่าง

    Code:
    <tr>
        <td class="primaryContent" style="white-space: nowrap;">{{{atk}}}</td>
        <td class="secondaryContent" style="white-space: nowrap;">{{{cmd}}}</td>
        <td class="primaryContent" style="white-space: nowrap;">{{{lvl}}}</td>
        <td class="secondaryContent">{{{imp}}}</td>
        <td class="primaryContent">{{{dmg}}}</td>
        <td class="secondaryContent [if={{{grd}}}===0]neutral[else]string[/if] [if={{{grd}}}>0]positive[/if][if={{{grd}}}<0]negative[/if]">{{{grd}}}</td>
        <td class="secondaryContent [if={{{hit}}}===0]neutral[else]string[/if] [if={{{hit}}}>0]positive[/if][if={{{hit}}}<0]negative[/if]">{{{hit}}}</td>
        <td class="secondaryContent [if={{{cnt}}}===0]neutral[else]string[/if] [if={{{cnt}}}>0]positive[/if][if={{{cnt}}}<0]negative[/if]">{{{cnt}}}</td>
        <td class="primaryContent">{{{scr}}}</td>
        <td class="secondaryContent">{{{nts}}}</td>
    </tr>

Share This Page