Server status with Codeigniter |
[eluser]Watermark Studios[/eluser]
You can keep it simple and just do a controller -> view implementation. That would be fastest for what you are trying to do. If you plan to expand it at all, I would personally put the ping function into a model for encapsulation/portability reasons. Especially if you plan to keep the $host_to_ping values in a database. But, sometimes "best practices" are overkill if you are doing something that can be accomplished in 17 lines. I'm just a stickler for OOP standards.
[eluser]JHackamack[/eluser]
I took it off a site that was procedural. Watermark Studios had a good idea of putting it in a model, but something like that can also live in a Helper function and still be usable.
[eluser]DephNet[Paul][/eluser]
[quote author="JHackamack" date="1287552406"]I took it off a site that was procedural. Watermark Studios had a good idea of putting it in a model, but something like that can also live in a Helper function and still be usable.[/quote]Would using a class work too? If so I will probably go down that route. Many thanks for your help both of you.
[eluser]JHackamack[/eluser]
You can use anything as long as you can access it. CodeIgniter is pretty flexible that way so it's all up to you.
[eluser]Watermark Studios[/eluser]
Hmmm...a helper function would be a great idea.
[eluser]DephNet[Paul][/eluser]
Hi again, I have decided to use a library for this and have come up with the following code, which works as it is: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Is that expected, or is there something stupid I am doing?
[eluser]JHackamack[/eluser]
I believe PHP is executed before the template stuff, so it's trying failing because it doesn't have anything to check against.
[eluser]DephNet[Paul][/eluser]
Me again, Thank you both for your help, I have finished the first version of this script and it is working as it should. If you want a look it is on http://status.fsirc.net.
|
Welcome Guest, Not a member yet? Register Sign In |