Welcome Guest, Not a member yet? Register   Sign In
Book - CodeIgniter for Rapid PHP Application Development (David Upton) Problem
#1

[eluser]bennyhill[/eluser]
I am going through this book and the author has this defined on page 189
$this->load->library('errors');

then uses what I think is a function from it on page 194
$this->failure($message, 'sites');

I get errors when I run this, codeigniter says it can't load that library. And for the life of me I cannot find anywhere in the book where he creates this library or defines any failure function.

This book if from 2007. IS it possible that there use to be an errors library native to CodeIgniter and that it is not there anymore in the current build? Anyone that is familiar with this book please let me know.

Thanks
#2

[eluser]sikkle[/eluser]
From what i remember of this book, those ERRORS and failure are givent as example of what you can build.

Maybe i'm wrong but i don't think those libs even exist in the current version of Ci.

Good luck !
#3

[eluser]Crimp[/eluser]
Perfect irony here.
#4

[eluser]David U[/eluser]
The 'errors' library was written specially for the book - it's not an original CI library - and it's explained on pages 176-7 together with the code for its only function, reportme().

$this->failure relates to a function in the 'crud' model - which I'm sorry I do seem to have omitted from the book. (At least I can't find it there, either.) The function is:

Code:
/*all-purpose 'failure' function: to return a bland generic message via the 'showall' table, for display to user*/
    function failure($controller ='' )
        {
        $blandmessage = "Sorry, it wasn't possible to do the action you requested at this time";
/*just in case the controller isn't set, send reply to a default controller.'*/
        if(!$this->db->table_exists($controller))
            {$controller = 'sites';}
        $this->showall($controller, $blandmessage);    
        }


Apologies once again, bennyhill.
#5

[eluser]bennyhill[/eluser]
Thank you. Will try it out tonight.
#6

[eluser]Asinox[/eluser]
i hav this book Smile
#7

[eluser]Suanko[/eluser]
Hi, I'm having a lot of trouble trying to make the CRUD system in this book to work. I'm not a great expert of codeingiter/php but i usually do ok. My main problem is there is not a full clean exemple of this CRUD, and there is missing Libraries.
For instance, i would very like to know where i can find this :
Code:
$this->load->library('menu');
Which is called here :
Code:
$fred = new menu;
If any of you people have a working sample project with this CRUD model, it would be very welcomed.
Thanks.
#8

[eluser]xwero[/eluser]
Suanko isn't the library not somewhere earlier in the book? Most of the times these books are an overly extensive user guide of a project.
#9

[eluser]Suanko[/eluser]
I've searched for it without success. In fact the display model, also called in this CRUD exemple can be found earlier in the book, but the only reference to the menu library is pointless. In fact, i manage to make this CRUD things work i think, at least i managed to gather some info from the database, maybe i need to spend more time digging in this. But i'm a bit disappointed not to have a full clean code template for this CRUD as it is a very useful model for many projects.
#10

[eluser]Asinox[/eluser]
[quote author="Suanko" date="1223986753"]Hi, I'm having a lot of trouble trying to make the CRUD system in this book to work. I'm not a great expert of codeingiter/php but i usually do ok. My main problem is there is not a full clean exemple of this CRUD, and there is missing Libraries.
For instance, i would very like to know where i can find this :
Code:
$this->load->library('menu');
Which is called here :
Code:
$fred = new menu;
If any of you people have a working sample project with this CRUD model, it would be very welcomed.
Thanks.[/quote]


go to the page 48, there's the menu code




Theme © iAndrew 2016 - Forum software by © MyBB