Hi guys,

I have just started yesterday using cakePhp.
I'm vamiliar with frameworks and always have used CodeIgniter.
Now i have to use cakePhp because the company i will work for is using
that.

and now the question i have:

I want to minimize the php code i use in my views by using chunks.

I have a chunk like this:

[code]
<tr>
        <td width="30"><?=$post['Post']['id']?></td>
        <td><?=$html->link($post['Post']['title'], "/post/view/".
$post['Post']['id'])?></td>
        <td><?=$post['Post']['created']?></td>
        <td width="30"><?php echo $html->link('Edit','/post/edit/'.
$post['Post']['id'])?></td>
    <td width="30"><?php echo $html->link('Delete','/post/delete/'.
$post['Post']['id'],null,'Are you sure? This action will delete this
post can not be ondone!')?></td>
</tr>
[/code]

normaly i would use this chunk of code in a view file like:

[php]
<?php foreach($vars as $vars): ?>
<tr>
        <td width="30"><?=$post['Post']['id']?></td>
        <td><?=$html->link($post['Post']['title'], "/post/view/".
$post['Post']['id'])?></td>
        <td><?=$post['Post']['created']?></td>
        <td width="30"><?php echo $html->link('Edit','/post/edit/'.
$post['Post']['id'])?></td>
    <td width="30"><?php echo $html->link('Delete','/post/delete/'.
$post['Post']['id'],null,'Are you sure? This action will delete this
post can not be ondone!')?></td>
</tr>
<?php endforeach; ?>
[/php]

I would like to load the chunk (multiple times) in the view file.

I tried to make a helper but using the <? include("file.php"); ?>
gives me an error...

I hope i make a sens on my question.

So... how would i inserts chunks of code in a view file with cakePhp.

Thanks a lot!

Auke.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to