![]() |
Repetive html with based on dynamic data - view partial vs helper - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Repetive html with based on dynamic data - view partial vs helper (/showthread.php?tid=29854) |
Repetive html with based on dynamic data - view partial vs helper - El Forum - 04-23-2010 [eluser]msteudel[/eluser] Hi All, I have your table listing out a bunch of items to that can be edited/deleted e.g. Name | Actions Mark | Edit - Delete Bill | Edit - Delete etc. I have the following view: Code: <table class="data"> My thought of how to generate the actions (Edit - Delete) was to either use another view or use a helper. I initially went with the view idea and have this: Code: <?php echo anchor( '/admin/district/update/' . $district['id'], 'Edit') ?> | But $district isn't available to the format_actions view. I'm not sure if there is an easy way to pass a variable into a "sub-view". If there isn't then I guess I'll go for a helper ... Any thoughts? TIA, Mark Repetive html with based on dynamic data - view partial vs helper - El Forum - 04-23-2010 [eluser]danmontgomery[/eluser] View 1: Code: <?php foreach( $districts as $district): ?> View 2: Code: <?php echo anchor( '/admin/district/update/' . $id, 'Edit'); ?> | Repetive html with based on dynamic data - view partial vs helper - El Forum - 04-23-2010 [eluser]Mischievous[/eluser] Whats your controller look like? Repetive html with based on dynamic data - view partial vs helper - El Forum - 04-23-2010 [eluser]msteudel[/eluser] Oh I suppose another option would be to just use a normal include ... though it'd be nice to keep things consistent with CI methods Repetive html with based on dynamic data - view partial vs helper - El Forum - 04-23-2010 [eluser]msteudel[/eluser] [quote author="Mischievous" date="1272070398"]Whats your controller look like?[/quote] Here's my controller: Code: function __construct() Repetive html with based on dynamic data - view partial vs helper - El Forum - 04-23-2010 [eluser]msteudel[/eluser] Oh an here's the main_teplate: Code: <?php Repetive html with based on dynamic data - view partial vs helper - El Forum - 04-23-2010 [eluser]msteudel[/eluser] [quote author="noctrum" date="1272070316"]View 1: Code: <?php foreach( $districts as $district): ?> View 2: Code: <?php echo anchor( '/admin/district/update/' . $id, 'Edit'); ?> | Oh ... I bet that's in the documentation ... thanks! |