Categories > TinyButStrong general >

question on example "Enter data in a form"

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Cactusbone
Date: 2006-05-20
Time: 04:45

question on example "Enter data in a form"

in "Enter data in a form" example in examples page, we can see in html source :
<select name="x_type" class="normal" id="select2">
                      <option value="[typeblk.val]">[typeblk.key;block=option]</option>
                      <option>[var.x_type;ope=html;select]</option>
                    </select>

trying it at home i get "parameter ope doesn't support value 'html'"
can anyone explains to me the [var.x_type;ope=html;select] part ?
By: Maz
Date: 2006-05-20
Time: 08:19

Re: question on example "Enter data in a form"

I fell for this one too. :)

If you are instantiating the class before before the data, you need to add the  line $TBS->PlugIn(TBS_INSTALL,TBS_HTML);

Example:

<?php
    require_once "../includes/init.php";
   
    if(!isset($_SESSION['logged_in']))
    {
        header("Location: http://www.invisioncube.com/gsdr/admin/login.php");
    }
   
    if($user_config['g_edit_user'] != 1)
    {
        header("Location: ".$site."admin/noperms.php");
    }
   
    //---------------------------------------------
    // Includes
    //---------------------------------------------
    include_once "../classes/tbs_plugin_html.php";
    include_once "../includes/admin-header.php";
   
    //---------------------------------------------
    // Initialise Variables
    //---------------------------------------------
    $user         = array();
    $lst_groups    = array();
   
    //---------------------------------------------
    // Do We Have a User ID in GET data?
    //---------------------------------------------
    if(isset($objGSD->vars_get['id']))
    {
        $user_id = intval($objGSD->vars_get['id']);
    }

    //---------------------------------------------
    // Create and Populate User Array
    //---------------------------------------------
    $query = "
        SELECT
            u.id,
            u.username,
            u.password,
            u.usergroup,
            u.enabled,
            g.name,
            g.id as group_id
        FROM gsd_users u
        LEFT OUTER
            JOIN gsd_groups g
        ON u.usergroup = 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_id = $user['group_id'];
   
    //---------------------------------------------
    // Create and Populate Enabled List Array
    //---------------------------------------------
    $lst_status     = array() ;
    $lst_status[]     = array('name'    => 'Enabled',    'id'    => 1) ;
    $lst_status[]     = array('name'    => 'Disabled',    'id'    => 0) ;
   
    $selgrp_id         = $user['group_id'];
    $selstatus_id    = $user['enabled'];

       
    //---------------------------------------------
    // Do We Have a Status in GET Data?
    //---------------------------------------------
    if(isset($objGSD->vars_get['status']))
    {
        switch ($objGSD->vars_get['status'])
        {
            case 0:
                $status_msg = "No Records Were Affected on the Previous Submission.";
                break;
            case 1:
                $status_msg = "Record successfully updated.";
                break;
        }
       
    }
   
    //---------------------------------------------
    // Load Relevant Template File
    //---------------------------------------------
    $objTpl->LoadTemplate('templates/users/useredit.html');
   
    //---------------------------------------------
    // Feed User Details
    //---------------------------------------------
    $objTpl->MergeField('user', $user);

    //---------------------------------------------
    // Feed Lists
    //---------------------------------------------
    $objTpl->MergeBlock('lst_groups', $lst_groups);
    $objTpl->MergeBlock('lst_status', $lst_status);
   
    //---------------------------------------------
    // Display Template
    //---------------------------------------------
    $objTpl->Render = TBS_OUTPUT;
    $objTpl->PlugIn(TBS_INSTALL,TBS_HTML);
    $objTpl->Show();
   
    include_once "../includes/admin-footer.php";
   
?>
By: Cactusbone
Date: 2006-05-21
Time: 07:07

Re: question on example "Enter data in a form"

thanks :) I haven't though it was using plugins :)