|
Class: HtmlLayout
Source Location: Program_Root/GUI/Layout.php
HtmlLayout is an editable grid layout system using HTML tables, allowing for more complex GUIs to be developed more easily or at least in a more automated fashion.
Author(s)
Version
- 1.2, 2002-08-18, $Id: Layout.php,v 1.3 2005/10/16 02:52:14 lux Exp $
Copyright
- Copyright (C) 2001-2003, Simian Systems Inc.
|
|
|
Child Classes
|
Inherited Variables
|
Inherited Methods
|
Class Details
[line 115]
HtmlLayout is an editable grid layout system using HTML tables, allowing for more complex GUIs to be developed more easily or at least in a more automated fashion. Note: Always reads from top-down *then* left to right. Take for example the following 3 x 3 grid:
a1 | b1 | c1
----+----+----
a2 | b2 | c2
----+----+----
a3 | b3 | c3
This grid can also be expressed as:
0,0 | 1,0 | 2,0
-----+-----+-----
0,1 | 1,1 | 2,1
-----+-----+-----
0,2 | 1,2 | 2,2
This would read a1, a2, a3, b1, b2, b3, etc. Be mindful of this when looping. Also of note when referring to cells is that you can refer to them in two different ways. The 'a1' notation is acceptable, and you can also pass an array of two values containing the column (x) and row (y) position of the cell. Please note that the first notation starts at 'a' and '1', but the second way starts at (0, 0). You can use the translate() method to convert between the two. Also note that there is a cell limit of 701 cols (from a to zz), regardless of which way you refer to them. This is probably way more than you should ever need anyway. However, should you need more columns, you can use the sub() method to create sub-layouts inside any cell for practically unlimited depth. There is no limit on the number of rows available. New in 1.2: - Fixed a bug in the render() output that was causing some cells not to appear.
- Increased the column limit from 26 to 701.
1 <?php 2 3 $layout = new HtmlLayout (3, 3); 4 5 // assign a template to cell a1 6 $layout->assign ('a1', 'test test test'); 7 8 // assign a template to c3 9 $layout->assign ('c3', 'foo bar'); 10 11 // create a sub-layout in b2 12 $b2 =& $layout->sub ('b2'); 13 14 // expand b2 one down 15 $layout->spanRows ('b2', 2); 16 17 // expand a1 two across 18 $layout->spanCols ('a1', 3); 19 20 // set some table properties 21 $layout->set ('table', 'border', '1'); 22 $layout->set ('table', 'width', '50%'); 23 $layout->set ('table', 'height', '50%'); 24 $layout->set ('table', 'cellspacing', '2'); 25 $layout->set ('table', 'cellpadding', '2'); 26 27 // assign b2 (the sub-layout)'s a1 cell a template 28 $b2->assign ('a1', 'qwerty'); 29 30 // render 31 echo $layout->render (); 32 33 ? >
Tags:
Class Variables
Class Methods
|
|