Welcome Guest, Not a member yet? Register   Sign In
Creating and using a library
#5

[eluser]dwlamb[/eluser]
I have tried to call the library using function index() of the controller user.php

Code:
function index() {
  $this->load->library('urls_library');
  if ($this->session->userdata('logged_in')) {
   redirect(...code...);
  } else {
   $this->load->view(...code...);
  }//if
}//index

...and at the start of the function which makes a call to the library on line 174
Code:
function edit_content() {
  if ($this->session->userdata('logged_in')){
   $this->load->library('urls_library');
  
   ...code...
  
   $urls_data = $this->Model_user->populate_urls($id,$this->session->userdata('user_id'));
   $data['url_pit'] = $this->Urls_library->make_urls($urls_data); //this is the syntax on line 174
   $this->load->view('view.php', $data);
  } else {
   redirect ("user/login");
  } //if...else
}//edit_recipe

This is the content of Urls_library.php. It is saved to application/libraries/. I checked permissions. They are 666.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Urls_library {

public function make_urls($result)
{
  if (count($result) > 0){
   $output  = "<ul class=\"url_list\">\n";
   foreach( $result as $key ){
    $output .= "<li>".form_hidden('id', $key['id'])."<a >"
      .$key['link_text']."</a>\n";
    $output .= "</li>\n";
   }
   $output .="</ul>\n";
   return $output;
  } else {
   return;
  }
}
}

/* End of file Urls_library.php */

I am really stumped.


Messages In This Thread
Creating and using a library - by El Forum - 06-24-2014, 01:07 PM
Creating and using a library - by El Forum - 06-24-2014, 01:42 PM
Creating and using a library - by El Forum - 06-24-2014, 02:42 PM
Creating and using a library - by El Forum - 06-24-2014, 04:39 PM
Creating and using a library - by El Forum - 06-24-2014, 09:38 PM
Creating and using a library - by El Forum - 06-24-2014, 11:55 PM
Creating and using a library - by El Forum - 06-25-2014, 02:09 AM
Creating and using a library - by El Forum - 06-25-2014, 01:28 PM
Creating and using a library - by El Forum - 06-25-2014, 02:20 PM
Creating and using a library - by El Forum - 06-25-2014, 02:26 PM
Creating and using a library - by El Forum - 06-25-2014, 02:57 PM
Creating and using a library - by El Forum - 06-25-2014, 03:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB