Categories > TinyButStrong general >

Item Not Selecting in TBS v3

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Maz
Date: 2006-05-18
Time: 09:55

Item Not Selecting in TBS v3

Firstly, congrats on getting v3 out the door! The best just got better still!

No, a small issue, but I think it's me, not TBS at fault.

I have the following code:

<?php
    require_once "../includes/init.php";
   
    if(!isset($_SESSION['logged_in']))
    {
        header("Location: http://www.invisioncube.com/gsdr/admin/login.php");
    }
   
    //---------------------------------------------
    // Include Template Plugins
    //---------------------------------------------
    include_once "../classes/tbs_plugin_html.php";
   
    //---------------------------------------------
    // Include Page Header
    //---------------------------------------------
    include_once "../includes/admin-header.php";

    //---------------------------------------------
    // Do We Have a User ID?
    //---------------------------------------------
    if(isset($_GET['id']))
    {
        $user_id = intval($_GET['id']);
    }

    //---------------------------------------------
    // Initialise Variables
    //---------------------------------------------
    $user         = array();
    $lst_groups    = array();
   
    //---------------------------------------------
    // Create and Populate User Array
    //---------------------------------------------
    $query = "
        SELECT
            u.username,
            u.password,
            u.group,
            u.enabled,
            g.name,
            g.id as group_id
        FROM gsd_users u
        LEFT OUTER
            JOIN gsd_groups g
        ON u.group = g.id
        WHERE u.id=".$user_id."";
       
    $rst = $objDB->get_row($query, ARRAY_A);
   
    if($objDB->num_rows > 0)
    {
        $user = $rst;
    }
   
    //---------------------------------------------
    // Create and Populate Groups Array
    //---------------------------------------------
    $query = "
        SELECT
            id,
            name
        FROM gsd_groups";
       
    $rst = $objDB->get_results($query, ARRAY_A);
   
    if($objDB->num_rows > 0)
    {
        $lst_groups = $rst;
    }
   
    $selgrp_name     = $user['name'];
    $selgrp_id         = $user['group_id'];
   
    //---------------------------------------------
    // Load Relevant Template File
    //---------------------------------------------
    $objTpl->LoadTemplate('templates/useredit.tpl.php');
   
    //---------------------------------------------
    // Feed User Details
    //---------------------------------------------
    $objTpl->MergeField('user', $user);

    //---------------------------------------------
    // Feed Group List
    //---------------------------------------------
    $objTpl->MergeBlock('lst_groups', $lst_groups);
   
    //---------------------------------------------
    // Display Template
    //---------------------------------------------
    $objTpl->Render = TBS_OUTPUT;
    $objTpl->Show();
   
    include_once "../includes/admin-footer.php";
   
?>

And the following template:

    <div id="main-copy">
        <h1 id="introduction">Edit Users</h1>
        <p>Use this page to add new users, delete existing users, and change passwords for your users.</p>
        <h1>User Details</h1>
        <form action="../processors/users.php" id="users" class="plainform" method="post">
            <fieldset>
                <input type="hidden" id="gpc_click" name="gpc_click" value="1" />
                <div class="fakerow clearfix">
                    <span class="left"><label for="username">* Username</label></span>
                    <span class="right">
                        <input type="text" class="textbox" maxlength="16"
                        name="username" id="username" tabindex="1" value="[user.username]" />
                    </span>
                </div>
                <div class="fakerow clearfix">
                    <span class="left"><label for="enabled">Account Status</label></span>
                    <span class="right">
                        <select class="select" name="enabled" id="enabled" style="width: 12em;">
                            <option value="1">Enabled</option>
                            <option value="0">Disabled</option>
                        </select>
                    </span>
                </div>
                <div class="fakerow clearfix">
                    <span class="left"><label for="enabled">User Group</label></span>
                    <span class="right">
                        <select class="select" name="group" id="group" style="width: 12em;">
                            <option value="[lst_groups.id]">[lst_groups.name;block=option]</option>
                            <option>[var.selgrp_id;ope=html;select]</option>
                        </select>
                    </span>
                </div>
          </fieldset>
          <fieldset id="sub">
            <input type="submit" value="Submit" class="button" />
          </fieldset>
         </form>
    </div>

It produces the following error:

TinyButStrong Error in field [var.selgrp_id...] : parameter ope doesn't support value 'html'. This message can be cancelled using parameter 'noerr'.
By: Maz
Date: 2006-05-18
Time: 10:09

Re: Item Not Selecting in TBS v3

lol As usual, I find the answer shortly after posting the issue. Because of the way I have the class loaded, I needed to add the

$objTpl->PlugIn(TBS_INSTALL,TBS_HTML);