Okay well I did that and it only displays the Category Names now. I did
a pr($data) and it came up with this:
----------
Array
(
[Category] => Array
(
[id] => 1
[title] => Test Category
)
)
----------
The View now looks like this:
----------
<div class="title">
<h4><?php echo $data['Category']['title']; ?></h4>
</div>
<div class="content">
<table border="1">
<tr>
<th>Title</th>
<th>Created</th>
<th>Actions</th>
</tr>
<?php foreach ($data as $row['Note']): ?>
<tr>
<td>
<?php echo $html->link($row['Note']['title'],
'/notes/view/'.$row['Note']['id']) ?>
</td>
<td>
<?php echo $row['Note']['created'] ?>
</td>
<td>
<?php echo $html->link('View',
'/notes/view/'.$row['Note']['id']) ?>
|
<?php echo $html->link('Edit',
'/notes/edit/'.$row['Note']['id']) ?>
|
<?php echo $html->link('Delete',
'/notes/delete/'.$row['Note']['id'], null, 'Are you sure you want to
delete "'.$row['Note']['title'].'"?') ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php pr($data);?>
----------
Under localhost/categories/view/1 it displays the table like this:
| 1 | Test Category | ... error msg ... | View | Edit | Delete
|
Doesn't display the Actual Note title though. Did I do something wrong?
This is the only thing that shows also. I have more then one note entry
for that category.
Thanks Again Nate!
- J
On Dec 15, 9:03 am, "nate" <[EMAIL PROTECTED]> wrote:
> <?php foreach ($data as $row): ?>
> should be
> <?php foreach ($data as $row['Note']): ?>
>
> Then take the ['Note'] part out of the subsequent array references. A
> helpful thing to do when coding your views is to put <?php pr($data);
> ?> at the bottom of your view, so you can read the structure of the
> array as you are designing.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" 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
-~----------~----~----~----~------~----~------~--~---