Welcome Guest, Not a member yet? Register   Sign In
How to classify in the good categories?
#11

[eluser]gRoberts[/eluser]
Ok, that's semi-good. What I would do now, is instead of using the column from each row to populate the category name, go back to using the {c_values} as you did before, but within your {values} loop, you should then use an if statement to filter out those rows that do not match the {c_id} of the {c_values} category.

i.e.

Code:
<tbody>
{c_values}
  <tr>
   <td colspan="13">{c_name}</td>
  </tr>
  {values}
{if c_id == h_cid}
  <tr>
   <td>{h_ip}</td>
   <td>{h_cidr}</td>
   <td>{h_hostname}</td>
   <td>{h_login}</td>
   <td>{h_password}</td>
   <td>{h_type}</td>
   <td>{h_services}</td>
   <td>{h_os}</td>
   <td>{h_os_version}</td>
   <td>{h_status}</td>
   <td>{h_desc}</td>
   <td>&lt;?php // echo anchor('roster/edit/{id}', 'edit'); ?&gt;</td>
   <td>&lt;?php // echo anchor('roster/delete/{id}', 'delete'); ?&gt;</td>
  </tr>
  {/endif}
{/values}
{/c_values}
</tbody>
#12

[eluser]Amalgame[/eluser]
The result with filtering!

Quote:{if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif} {if c_id == h_id} {/endif}
IP CIDR Hostname Login Password Type Services OS Version Status Note
Deadline
192.168.1.1 24 router.totore.local admin admin vm gw, ns, vpn freebsd 9.0 on freebsd router
192.168.1.10 24 www.totore.local admin admin vm http freebsd 9.0 on freebsd web server
192.168.1.20 24 mail.totore.local admin admin vm imap, smtp freebsd 9.0 on freebsd mail server
192.168.1.200 24 esxi.totore.local admin admin server vm vmware esxi 5.0.0 on vmware vsphere
Frontend
192.168.1.1 24 router.totore.local admin admin vm gw, ns, vpn freebsd 9.0 on freebsd router
192.168.1.10 24 www.totore.local admin admin vm http freebsd 9.0 on freebsd web server
192.168.1.20 24 mail.totore.local admin admin vm imap, smtp freebsd 9.0 on freebsd mail server
192.168.1.200 24 esxi.totore.local admin admin server vm vmware esxi 5.0.0 on vmware vsphere
Backend
192.168.1.1 24 router.totore.local admin admin vm gw, ns, vpn freebsd 9.0 on freebsd router
192.168.1.10 24 www.totore.local admin admin vm http freebsd 9.0 on freebsd web server
192.168.1.20 24 mail.totore.local admin admin vm imap, smtp freebsd 9.0 on freebsd mail server
192.168.1.200 24 esxi.totore.local admin admin server vm vmware esxi 5.0.0 on vmware vsphere
#13

[eluser]gRoberts[/eluser]
You should really only need to check that the current row in {values} has the same category id as the current {c_values} row.
#14

[eluser]Amalgame[/eluser]
Okay, I admit that even by reading the code, I can not find how to fix it...

Thank you for your help gRoberts Smile
#15

[eluser]gRoberts[/eluser]
Without really playing with your code, it's hard to play.

Using normal PHP, it should be as simple as:

Code:
<tbody>
&lt;? foreach($c_values as $category) : ?&gt;
  <tr>
   <td colspan="13">&lt;?= $category->c_name; ?&gt;</td>
  </tr>
  &lt;? foreach($values as $value) : ?&gt;
&lt;? if($value->i_cid == $category->c_id) : ?&gt;
  <tr>
   <td>{h_ip}</td>
   <td>{h_cidr}</td>
   <td>{h_hostname}</td>
   <td>{h_login}</td>
   <td>{h_password}</td>
   <td>{h_type}</td>
   <td>{h_services}</td>
   <td>{h_os}</td>
   <td>{h_os_version}</td>
   <td>{h_status}</td>
   <td>{h_desc}</td>
   <td>&lt;?php // echo anchor('roster/edit/{id}', 'edit'); ?&gt;</td>
   <td>&lt;?php // echo anchor('roster/delete/{id}', 'delete'); ?&gt;</td>
  </tr>
  &lt;? endif; ?&gt;
  &lt;? endforeach; ?&gt;
  &lt;? endforeach; ?&gt;
</tbody>

This is assuming you have a column in the `ids` table for your category.
#16

[eluser]Amalgame[/eluser]
gRoberts you're wonderful!

It's run!

Quote:IP CIDR Hostname Login Password Type Services OS Version Status Note
Deadline
192.168.1.1 24 router.totore.local admin admin vm gw, ns, vpn freebsd 9.0 on freebsd router
Frontend
192.168.1.10 24 www.totore.local admin admin vm http freebsd 9.0 on freebsd web server
192.168.1.20 24 mail.totore.local admin admin vm imap, smtp freebsd 9.0 on freebsd mail server
Backend
192.168.1.200 24 esxi.totore.local admin admin server vm vmware esxi 5.0.0 on vmware vsphere

Thank you very much! Big Grin

Now I see why it does not work with the template parser library, but if it works with your method, it's perfect Smile

Thank you again!
#17

[eluser]gRoberts[/eluser]
Glad to be of service.

I've never used the template parsing side of CI, as I find PHP's code a lot cleaner and when looking from the outside, as a developer, I'd probably freak trying to work out what's happening where.

Could be worth looking into using PHP instead. You have a lot more flexibility and they both work together if I recall correctly.
#18

[eluser]Amalgame[/eluser]
I am a former developer of MODs for phpBB on this bulletin board there is the same with the template parser library and I found it clean because there is no PHP code in HTML pages!

It is best to keep the old methods when you do not know completely a framework Smile

Anyway I'm happy to use CI as it is very light and very strong I think!




Theme © iAndrew 2016 - Forum software by © MyBB