Jump to content


Displaying Record name while editing

Edit breadcrumb Pass Data

  • Please log in to reply
3 replies to this topic

#1 abhishek

abhishek

    Member

  • Members
  • PipPip
  • 10 posts

Posted 09 May 2013 - 10:53 AM

Hi All

 

I want to display the name of the record in breadcrumb when i am editing a record.

Or we can also say i want to pass the name of record to view.

 

 

Ex:-  My  Breadcrumb looks like Home>>Projects>>EditProjects

But i want when i edit a particular record it should display Edit"ProjectName".

 

This is how i am creating the breadcrumbs

 <div id="breadcrumb">
        <a href="<?php echo ADMIN_SITE_URL.'projects'; ?>">Dashboard</a>
        <span class="pipe"> <?php echo '&rsaquo;&rsaquo;';  ?></span>
        <a href="<?php echo ADMIN_SITE_URL.str_replace(' ','',strtolower($subject));?>"><?php if(strtolower($subject) != 'record'): echo $subject; else: echo '&nbsp;'; endif; ?> </a>
        <span class="pipe"> <?php echo '&rsaquo;&rsaquo;';  ?></span>Edit <?php echo $subject;?>
         </div>

 



#2 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 09 May 2013 - 11:06 AM

From your controller you pass on the view a variable with the project name.

Additionaly you can use get_state where you can differentiate the output of the breadcrumb depending on where you are.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#3 abhishek

abhishek

    Member

  • Members
  • PipPip
  • 10 posts

Posted 09 May 2013 - 11:09 AM

How will i determine the name of the project..??
I want when a click on edit button against a particular record , then it should display name of record



#4 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 09 May 2013 - 11:47 AM

I assume some sort of function produces the breadcrumb, if not then it is a good idea to have a function within your controller.

So we assume that we have something like this 

 

private function breadcrumb($level, $table, $id, $state)
{
$this->load->model('my_model');
$project_name = $this->my_model->get_project_name($table, $id);
if($state == 3) $operation = 'Edit';
return 'Home>>' . $level . '>>' . $operation . ' ' . $project_name;
}

public function my_controller()
{
$crud = new grocery_CRUD();
$subject = 'Project';
$crud->set_subject($subject);
...
...
$data['breadcrumb'] = $this->breadcrumb($subject . 's', 'projects', $this->uri->segments(3), $crud->getState());
$this->load->view('myview', $data);

}
 

For the model part check the manual.


Edited by davidoster, 09 May 2013 - 11:56 AM.

____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr






Also tagged with one or more of these keywords: Edit, breadcrumb, Pass Data

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users