Welcome Guest, Not a member yet? Register   Sign In
As a newbie is it appropriate to write custom code or....
#1

[eluser]wajihasalman[/eluser]
As a newbie is it appropriate to write custom code or use built in libraries like CJAX, flexi-auth, grocery CRUD etc...
#2

[eluser]CroNiX[/eluser]
Depends on your needs and goals. Personally I try to use others (established AND maintained) libraries/extensions so that I don't have to waste my customers money building something that already exists elsewhere. Chances are that their library takes things into consideration that you might not think about. I don't want to spend a few days writing a user authentication system, testing it, making sure it's secure, etc., when I can use one that many people have contributed to and refined with the best security practices and start using in 10 minutes.

But if you're new, it's also not a bad idea to see how others write their libraries to see what they're doing. It will help you learn CI and become a better coder.
#3

[eluser]wajihasalman[/eluser]
Thanks Cronix for your quick reply, I am new to CI and building an Agency website using CI as my boss wants it to be in php rather than using some opensource CMS.

So far I have very basic requirement to create an admin panel, I am not sure if I might have to extend things in future.

One major requirement is that there will be 2 types of users, first an Administrator and second normal users with some simple functionality, so I am a little confuse whether to go for it or not.
#4

[eluser]CroNiX[/eluser]
You might be new to CI, but how good are you with PHP? Especially when it comes to security and best practices which is crucial for user authentication?

I'd check out http://community-auth.com/. It probably does everything you need and more and would probably save you a lot of coding hours, which would probably also make your employer happy Smile
#5

[eluser]wajihasalman[/eluser]
Thanks I will give a try to it. Also i am facing a little issue with my function to create a new page. Whenever I access my create page through browser it inserts empty record with 0 value which is something I am confused about.

Code:
function add_pages($data){

  $this->db->insert('pages', $data);
  return;
}
//This is my function from model.

function index(){


  $this->clientauth->is_logged_in();
  $data =  array();

  if($query = $this->Pages_model->get_pages())
  {
   $data['pages_records'] = $query;
  }
  $this->load->view('pages/page_listing', $data);


}

function create_page(){

$this->load->view('pages/create_page');

$data = array(
   'title_page' => $this->input->post('title'),
   'page_description' => $this->input->post('content')
   );

$this->Pages_model->add_pages($data);


  $this->index();

}

//These 2 functions are from my Pages Controller file.

I have been following a tutorial for startup.
#6

[eluser]CroNiX[/eluser]
I assume this is the controller? In your create_page(), you use Pages_model::add_pages(). Is that method in that model? I'm just confused because you have an add_pages() method in this controller.

If Pages_model::add_pages() is correct, please post that method from that model.
#7

[eluser]wajihasalman[/eluser]
I tried attaching files but its not attaching, well here are some screenshots for better understanding:

From Pages Controller file:
http://prntscr.com/43jykt

From Pages Model File:

http://prntscr.com/43jysi

Create Page View file:

http://prntscr.com/43jywd

Let me know if this sounds clear...




Theme © iAndrew 2016 - Forum software by © MyBB