CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 To Elena: author of 'Several Columns Grid' Article

Print topic Send  topic

Author Message
Tomasz
Posted: 01/04/2002, 1:51 PM

Elena,

I cannot force your example to work on php with templates.
Grid display all links in one row
Elena
Posted: 01/08/2002, 12:37 AM

Tomasz,
as I mentioned in the article the proposed solution is for PHP nontemplate pattern. I see that you use PHP+Templates in your project. As this pattern uses template functions the code in CustomShow event should be different to proposed one. To help you to achieve the result you want I uploaded modified YellowPages project for PHP+Templates at:
http://www.gotocode.com/UserImages/Elena/YellowPages.ccs
Refer to Page page/Form1 form/Open and CustomShow events to find PHP code. Then .html file will require some modification. Open generated file and find code:
<tr>
<td {DataTD}><font {DataFONT}>{name} </font></td>
</tr>

modify it to get:
{open}
<td {DataTD}><font {DataFONT}>{name} </font></td>

Now, you'll get Grid form in 3 columns.

As you have three (not one as in example) fields on the form the code in .php file as well as inhtml file should contain more fields. But the principle is the same.
You can aslo refer to GotoCode article:
http://www.gotocode.com/art.asp?art_id=115&
but the example posted there is also for templateless pattern.
Tomasz
Posted: 01/09/2002, 2:33 AM

Elena,

your example shows one column, not 3...
just look at screen dump:
http://www.hallo.com.pl/cc/yellow.gif
Elena
Posted: 01/09/2002, 5:07 AM

Tomasz,
looks like you haven't modified .html file as I suggested in my previous response. The code won't work without modifications in .html file. Generate the site, then open Page.html in any html editor and make the provided changes. Save the file, don't regenerate the site in CC(!) and run Page.php in browser.
Tomasz
Posted: 01/09/2002, 10:57 AM

OK, sorry, I've missed to delete <tr>'s. It works now.

Can you help me wth code which displays 2 fields; the first is picture, second is product name below, both working as a url to product details page?

I store pics file names in db (field 'image') and I can display them on page using the following code in before show event:

if ($fldimage!=null) {
$tmpfile = "images/".$fldimage;
$fldimage = "<img src=$tmpfile width=50 height=50>";
}
else {
$fldimage="<font size=1>No picture</font>";
}
Elena
Posted: 01/10/2002, 1:40 AM

Hello,
the approach is similar in case you want to display 2 or more fields. Add two fields to the form, add the code to BeforeShow event and to Open event. Then go to CustomShow event and obtain generated code. You'll get the code from BeforeShow event at the top, then comments:
//-------------------------------
// Replace Template fields with database values
//-------------------------------

and some lines of set_var() and parse() code. Add the custom code provided in example you have between mentioned comments and template code, e.g.:
//-------------------------------
// Replace Template fields with database values
//-------------------------------
$point = $i/3;
if (strpos($point, ".") == "")
{
$tpl->set_var("open", "</tr><tr>");
}
else
{
$tpl->set_var("open", "");
}

$tpl->set_var("email", tohtml($fldemail));
$tpl->set_var("name", tohtml($fldname));
$tpl->parse("DListForm1", true);

Don't forget to add $i++; at the end.
The next step is .html file modification. Very simple. Open the file find the fields listed:
<tr>
<td>first field</td>
<td>seond field</td>
</tr>

remove both </tr> tag and replace <tr> with {open}.
That's all.
Tomasz
Posted: 01/14/2002, 8:17 AM

Elena,

Works OK, thank you.
Now I have 2 fields in a form, one of them shows picture, second picture's name.

But I have problem with sorting records; even though I have checked primary key in form at 'name' field, records on page are sorted by 'item_id' (which doesn't exist in the form...).

How to sort them by 'name' field?
Elena
Posted: 01/15/2002, 2:02 AM

Tomasz,
the proposed code in CustomShow event doesn't affect on table sorting.
Print generated query to check what field it is sorted by and check the 'Order By' on SQL tab, may be you have selected "item_id" there.
In case you modify anything on the form, e.g. add one more field or remove it note the changes won't be applied to CustomShow event code and you should edit it manually.
adsfas
Posted: 01/17/2002, 12:41 AM

dfasdfads
Tomasz
Posted: 02/02/2002, 1:31 PM

Elena,

IE browser is very, very tolerant for wrong html, so I didn't see it before. My page was displayed sligtly different than others, so in the end I've looked at code generated and found mistakes: there are no some <tr>'s and some </tr>'s are not neccesary.

Pls look at these files: http://www.hallo.fiber.net.pl/cc/

O.html is a copy from browser source. Open it in any editor showing html errors, you will see single </tr>'s before <tr>'s, no <tr></tr> in table, no closing </tr>. I've added some comments to code for you.

You will find there also oferta.html (template from CC) and oferta.php.

And this is code in custom show event of each form:
//-------------------------------
// Replace Template fields with database values
//-------------------------------
$point = $i/8;
if (strpos($point, ".") == "")
{
$tpl->set_var("open", "</tr><tr>");
}
else
{
$tpl->set_var("open", "");
}
$tpl->set_var("item_id", tohtml($flditem_id));
$tpl->set_var("image_small", $fldimage_small);
$tpl->set_var("nazwa", tohtml($fldnazwa));
$tpl->set_var("nazwa_URLLink", $fldnazwa_URLLink);
$tpl->set_var("Prmnazwa_item_id", urlencode($fldnazwa_item_id));
$tpl->parse("DListdoro_exclusive", true);
$i++;
//-------------------------------

of course DList are different for another forms, and $i = 0; is in each open event.


ELENA
Posted: 04/28/2003, 8:16 PM

ELENA WHY IS IT THAT NO RECORDS ARE DISPLAYING IN MY PAGE........ WHEN I USED THIS KIND OF 'Several Columns Grid' PROGRAM RUNNING IN ASP
MHICHEY
Posted: 04/28/2003, 11:58 PM

WHY IS IT THE ALL THAT I ONLY HAVE ONE ROW DISPLAYES.........I HAVE 27 RECORDS SO WHEN IT IS DIVIDED BY 3 I SHOULD GET 3 COLUMNS AND 9 ROWS

BUT IN MY CASE I RECEIVED 27 COLUMNS AND I ROW.......

PLEASE HELP ME I EXHAUSTED...........
Elena
Posted: 04/29/2003, 5:41 AM

MHICHEY
Please check you have modified HTML code correctly.
Find the table cell where the filed should be displayed:
<tr>
<td {DataTD}><font {DataFONT}>{name} </font></td>
</tr>

You should get the following code after modification.
{open}
<td {DataTD}><font {DataFONT}>{name} </font></td>

I also suggest that you try this code
if ((int)($i/3) == $i/3)
instead following lines:
$point = $i/3;
if (strpos($point, ".") == "")

Regards,
Elena
MICHEY
Posted: 04/29/2003, 6:33 PM

THANKS FOR THE HELP ELENA .... YOU KNOW I PRAY FOR THIS TO MEET MY DEADLINE...
HOPE YOU WILL NOT STOP READING THE COMMUNITY PAGE BECAUSE A LOT OF US NEED YOUR HELP.......

GOD BLESS!!
michey
Posted: 04/29/2003, 6:33 PM

I ALREADY MADE SEVERAL COLUMNS, THE NEXT PROBLEM IS I WANT TO PUT URL TO EVERY FIELD AND LINK IT... TO A CORRESPONDING RECORD...
Lindsay
Posted: 10/15/2003, 10:51 AM

How do I do your example in just asp? I can not seem to fiqure out how to get php installed on IIS 5.0..



   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.