Categories > TinyButStrong general >

unable to merge block

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: chris
Date: 2008-12-27
Time: 11:02

unable to merge block

can someone offer me a help? i am try to view all the infor of the particular records in my table. i divide it into 3 files that are search.html, view.html, and view.php.

Here is the extracted code of search.html
*********************************

    <tr bgcolor="#F0F0F0">
        <td>[blk.name;block=tr;bmagnet=table]</td>
        <td>[blk.fname]</td>
        <td>[blk.lname]</td>
        <td>[blk.contactNo]</td>
        <td>[blk.street]</td>
        <td>[blk.city]</td>
        <td>[blk.state]</td>
        <td style="text-align:center">
        <a href="view.php?id=[blk.suppID]"><img src="../img/view.gif" title="View" alt="View" border="0" /></a>&nbsp;
        <a href="edit.php?id=[blk.suppID]"><img src="../img/edit.gif" title="Edit" alt="Edit" border="0" /></a>&nbsp;
           <a href="#" onclick="return verify([blk.suppID])"><img src="../img/delete.gif" title="Delete" alt="Delete" border="0" /></a></td>
    </tr>

Here is the extracted code of view.html
**********************************

    <table>
        <tr>
            <th colspan="2">Supplier Information</th>
        </tr>
        <tr>
            <td class="attribute">Company Name</td>
            <td><input type="text" name="name" class="text" value="[blk.name]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">Supplier Salutation</td>
            <td><input type="text" name="salutation" class="text" value="[blk.salutation]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">First Name</td>
            <td><input type="text" name="fname" class="text" value="[blk.fname]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">Last Name</td>
            <td><input type="text" name="lname" class="text" value="[blk.lname]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">Contact Number</td>
            <td><input type="text" name="contactNo" class="text" value="[blk.contactNo]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">Street</td>
            <td><input type="text" name="street" class="text" value="[blk.street]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">City</td>
            <td><input type="text" name="city" class="text" value="[blk.city]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">Postcode</td>
            <td><input type="text" name="postcode" class="text" value="[blk.postcode]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">State</td>
            <td><input type="text" name="state" class="text" value="[blk.state]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">Created By</td>
            <td><input type="text" name="createdby" class="text" value="[blk.createdby]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">Modified By</td>
            <td><input type="text" name="modby" class="text" value="[blk.modby]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">Date Created</td>
            <td><input type="text" name="datecreate" class="text" value="[blk.datecreate]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td class="attribute">Date Modified</td>
            <td><input type="text" name="datemod" class="text" value="[blk.datemod]" readonly="readonly" /></td>
           </tr>
        <tr>
            <td><input type="button" value="Cancel" name="cancel" /></td>
        </tr>

Here is the extracted code of view.php
*********************************

<?php

$conn = mysql_connect('localhost','root','');
if(!conn){
   die('Could not connect to: '.mysql_error());
}

mysql_select_db('test',$conn);

include_once('../tbs_class.php');
$TBS =& new clsTinyButStrong;
$TBS->LoadTemplate('view.html');

if($id != ''){
    $SQL = "SELECT * FROM tbl_supp WHERE suppID = ".$id;
}

if ($SQL != ''){
  $TBS->MergeBlock('blk','mysql',$SQL);
}

$TBS->Show();
mysql_close($conn);
?>

********************************************************

What i trying to do here is when i press the view.gif image at search.html i want to tabulate my records for the particular row to display out at view.html. Is this is correct way of doing it? I would appreciate if someone can give me help or advise on this. Thanks.
By: TomH
Date: 2008-12-28
Time: 14:25

Re: unable to merge block

Chris,
Your approach is okay - assuming that you've got the search.php code working to populate the search.html template correctly.

What result are you actually getting?
What's _not_ working?
By: chris
Date: 2009-01-10
Time: 06:26

Re: unable to merge block

I'm not too sure what happen behind it.. But from what i see it should work properly.
Here is the result once i press the view button.
http://img82.imageshack.us/my.php?image=testbf1.jpg