CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Image gallery, try this way

Print topic Send  topic

Author Message
Aleister

Posts: 73
Posted: 02/22/2004, 5:15 PM

Creating a gallery in CCS 2

Let's suppose you have a table with fields:
id (autonumber)
picfilename (the picture filename)
description
url (where this picture links)

You create a grid using the builder (let's call it gallery_grid) (without Alt rows for now) and select to show all fields exept id

if you check the HTML for the generated grid you 'll see something like this:
  
    <!-- BEGIN Row -->  
      <tr>  
        <td>  
           {picfilename}  
        </td>  
        <td>  
           {description}  
        </td>  
        <td>  
           {url}  
        </td>  
       </tr>  
     <!-- END Row -->  

move all variable tags in one cell like this
  
<td>  
  {picfilename}  
  {description}  
  {url}  
</td>  
<td>  
</td>  
<td>  
</td>  

In the Design mode of CCS Delete all columns exept the one with the labels (id, picfilename etc)

Move <tr> tag before <!-- BEGIN Row --> and </tr> tag after <!-- END Row --> so your html will look like this:
  
    <tr>  
    <!-- BEGIN Row -->  
      <td>  
       {picfilename}  
       {description}  
       {url}  
      </td>  
    <!-- END Row -->  
    </tr>  

This way when the grid is displayed it will not change row for every record, as a matter of fact it will never change row until end of data...

Create a new label after url label and name it changeline. Change content property from text to html

In the before show events of this label enter this code:

  
    global $gallery_grid;  
    global $dumcount;  
  
	$dumcount++;  
	if ($dumcount>=4) // 4 is for 4 columns, change it with the number of columns you want to display  
	{  
		$gallery_grid->changeline->SetValue("</tr><tr>");  
		$dumcount=0;  
	}  
	else  
	{  
		$gallery_grid->changeline->SetValue("");  
	}  

Now go to Code Tab (not events) and just after <?php> type:

  
   global $dumcount;  
   $dumcount=0;  

The pic display thing in the grid is the last part:
change the html of the record between <!-- BEGIN Row --> and <!-- END Row --> as follows:

  
    <!-- BEGIN Row -->  
      <td>  
        <a href="{url}" target="_blank"><img src="YourPicFolder/{picfilename}" border="0"></a>  
        <br>  
        {description}{changeline}  
      </td>  
    <!-- END Row -->  

Finish!

It is simpler than it looks, the general idea is this:
- Put all labels in one cell.
- Delete all extra columns and leave only one
- After the data labels put a label that echoes a change row every x times
- Modify the way that field-data shows on screen

You have no need to modify any of the CCS auto-generated code

Now customize as you wish, create thumbs on-the-fly, hyperlink to a details-page, add Alt_rows or whatever.

Hope it will be useful.

Aleister
View profile  Send private message
dirksamson

Posts: 32
Posted: 02/23/2004, 12:52 AM

Beauty!
_________________
Dirk
View profile  Send private message
dirksamson

Posts: 32
Posted: 02/23/2004, 1:12 AM

However, shouldn't you put your {changeline} tag AFTER closing the <td> ?

<!-- BEGIN Row -->
<td>
<a href="{url}" target="_blank"><img src="YourPicFolder/{picfilename}" border="0"></a>
<br>
{description}
</td> {changeline}
<!-- END Row -->

This way your last td will be closed, then the row will be closed and the next row opened before the next <td>.

Question: how does your script handle the last line? (4 columns; what will the html look like with 6 and exactly 8 pictures to show?
_________________
Dirk
View profile  Send private message
Aleister

Posts: 73
Posted: 02/23/2004, 2:59 PM

Dirksamson,

You are right,
{changeline} goes after
</td>

I rewrote the code for the post and put it in the wrong place, thanks for the correction.

The last line has no problem to be displayed,

the code will look like this:
  
<tr>  
   <td>  
   </td>  
   <td>  
   </td>  
   <td>  
   </td>  
   <td>  
   </td>  
   <td>  
   </td>  
   <td>  
   </td>  
</tr>  
<tr>  
   <td>  
   </td>  
   <td>  
   </td>  
</tr>  
View profile  Send private message

Add new topic Subscribe to topic   


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

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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