[eluser]Taff[/eluser]
I've spent quite some time browsing the forum, bookmarking things that I will probably need on my way, but haven't been able to find a solution to this, which either means I don't know what I'm on about, or I have no idea what I'm on about.
I have built a little class based on the blog tutorials to create names for projects.
class Project extends Controller {
Code:
function Project(){
parent::Controller();
$this->output->enable_profiler(TRUE);
$this->load->scaffolding('projects');
$this->load->helper('url');
$this->load->helper('form');
}
function index(){
$data['title'] = "Project Management";
$data['subtitle'] = "| Nothing more, nothing less";
$data['query']= $this->db->get('projects');
$this->load->view('project_display',$data);
}
function p_list(){
$data['query']= $this->db->get('projects');
$this->load->view('project_list',$data);
}
}
In particular I like my project_list view which I'm embedding into my project_display view and works very nicely without me having to repeat the code anymore.
My next step was to make a client class for all my client information. This client class is essentially very similar and allows me to output their data in a list using my client_display view:
Code:
<div id="normalcontent">
<h3>Clients</h3><p><?php echo anchor('client/add', 'Add a new client' , array('title' => 'Click to add a new company')) ?></p>
<?php foreach ($c_query->result() as $row): ?>
<div style="width:50%;float:left;">
<h4><?php echo anchor('clients/'.$row->client_id, $row->name , array('title' => 'Click to edit '.$row->name)); ?></h4>
<p>Address <?php echo $row->address; ?><br />
City <?php echo $row->city; ?><br />
State <?php echo $row->state; ?><br />
Zip <?php echo $row->zip; ?><br />
Country <?php echo $row->country; ?><br />
URL<?php echo $row->url; ?><br />
Phone<?php echo $row->phone; ?><br />
Fax <?php echo $row->fax; ?></p>
<?php echo anchor('clients/'.$row->client_id, 'Edit' , array('title' => 'Click to edit '.$row->name)); ?>
</div>
<?php endforeach; ?>
</div>
I am now at a total loss as to how I can embed my project_list into this view. Everything I have tried tells me it can't find query or mad attempts such as
$projects=$this->Projects->p_list();
have had no avail.
As mentioned at the beginning this is most probably due to my lack of terminology and a total grasp of the pattern, and maybe I should be approaching this is a different manner?
Thanks for any pointers!
Taff