I always use tableCells when I output a table. The way I think of it is:
1. Outer array contains all the rows
2. Each secondary array contains each row
3. Each element contains each cell
4. The element can be an array that contains options for the cell
$html->tableCells(
array(
array(
'Plain text',
array('Cell text', array(--options--)),
array('Cell text', array(--options--))
),
array(
array('Cell text', array(--options--)),
'Plain text',
array('Cell text', array(--options--))
),
array(
array('Cell text', array(--options--)),
array('Cell text', array(--options--)),
'Plain text'
),
)
);
So adapting the example in the book you get:
<table>
<?php echo $html->tableCells(
array(
array(
'Jul 7th, 2007',
array('Best Brownies', array('class'=>'highlight')),
'Yes'
),
array(
'Jun 21st, 2007',
array('Smart Cookies', array('valign' => 'top')),
'Yes'
),
array(
'Aug 1st, 2006',
'Anti-Java Cake',
array('No', array('id'=>'special'))
),
)
);
?>
</table>
When I put this in a view I get valign top for the Smart Cookie Cell.
Jeremy Burns
[email protected]
On 15 Apr 2010, at 10:12, Lucca Mordente wrote:
> I don't think so
>
> On 14 abr, 18:00, Ed Propsner <[email protected]> wrote:
>> In all honesty it's easier to write out the html tags ... I was just playing
>> around it. Am I reading it wrong or does the book give you the impression
>> that it can be
>> done?http://book.cakephp.org/view/1435/Inserting-Well-Formatted-elements
>>
>> On Wed, Apr 14, 2010 at 4:13 PM, Lucca Mordente
>> <[email protected]>wrote:
>>
>>
>>
>>> Hi Ed,
>>> Probably you can achieve what you want using css.
>>> It seems that isn't possible to add attributes using this html helper
>>> method.
>>
>>> Lucca Mordente
>>
>>> On 14 abr, 16:57, Ed Propsner <[email protected]> wrote:
>>>> Looking at the section in the book for $html->tableCells it says ...
>>>> "Wrap a single table cell within an array() for specific
>>> <td>-attributes."
>>
>>>> $html->tableCells(array('foo', 'bar'));
>>
>>>> will ouput
>>
>>>> <tr>
>>>> <td>foo</td>
>>>> <td>bar</td>
>>>> </tr>
>>
>>>> I'm having a few issues with this one.
>>>> Could someone give me a quick example of how to output the same code
>>>> utilizing a <td> attrib. ?
>>
>>>> Ie.
>>>> <tr>
>>>> <td valign="top">foo</td>
>>>> <td>bar</td>
>>>> </tr>
>>
>>>> Thanks,
>>>> - Ed
>>
>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
>>> with their CakePHP related questions.
>>
>>> You received this message because you are subscribed to the Google Groups
>>> "CakePHP" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]<cake-php%[email protected]
>>> om>For more options, visit this group at
>>> http://groups.google.com/group/cake-php?hl=en
>>
>>> To unsubscribe, reply using "remove me" as the subject.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en