⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

passing controller



redhen_07
  • profile picture
  • Member

Posted 13 August 2013 - 02:39 AM

hi i have a question i know this is not related to GC thats why i post it here but im using GC on my application and create a bootstrap tabs on edit view fields..

 

  <ul class="nav nav-tabs">
    <li class="active"><a href="<?php echo site_url("faculty/main/mainlist/edit/".$row->id)?>">Home</a></li>
    <li><a href="<?php echo site_url('faculty/main/list/edit/'.$row->id)?>">Profile</a></li>

    </ul>

i got an error the $row not defined, i know its on my controller to pass the the $row.. im new to CI i dont know how to proper code on that link..


davidoster
  • profile picture
  • Member

Posted 14 August 2013 - 20:26 PM

Where do you get from the $row object?


redhen_07
  • profile picture
  • Member

Posted 16 August 2013 - 01:52 AM

sir david thank you for you reply as my example the $row object is not set on my controller, thats why i asked how can i pass id from my table on my controller using this $row->id,

 

to be able to use on my tabular view:

 

  <ul class="nav nav-tabs">
    <li class="active"><a href="<?php echo site_url("faculty/main/mainlist/edit/".$row->id)?>">Home</a></li>
    <li><a href="<?php echo site_url('faculty/main/list/edit/'.$row->id)?>">Profile</a></li>
    </ul


davidoster
  • profile picture
  • Member

Posted 16 August 2013 - 15:38 PM

I can't really answer that!

The typical is to pass from the controller to a view!


jinbatsu
  • profile picture
  • Member

Posted 15 December 2013 - 16:03 PM

In your Controller:


//....
$rows_from_db = ''; // your object query result sql
$data['rows'] = $rows_from_db;
$this->load->view('default_view', $data);


In your View:

<ul class="nav nav-tabs">
<?php foreach ($rows as $row) { ?>
    <li><a href="<?php echo site_url('faculty/main/mainlist/edit/'.$row->id)?>"><?php echo $row->title; ?></a></li>
<?php } ?>
</ul>

preg
  • profile picture
  • Member

Posted 09 January 2014 - 11:34 AM

sure jinbatsu has the better answear for that topic. You have to pass your data. Else you could generate a global var but not recommanded.

If u want to use some render with controller like sf2, i don't know if it's possible here.