Currently I am working on one Web-based software which creates results automatically in codeigniter. I create modules like add student, add marks & generate mark sheet. here in generate marksheet i created individual marksheet but now I want to generate code for generate marksheet on one button click.
For that i use file_get_content(), curl(), fopen() but this all showing blank page if file_get_content("http://127.0.0.1/exam/admission/forms/showResult/41/2/1")
shows individual students result i want to show it in page
Here is My controller code
class forms extends CI_Controller {
function __construct() {
parent::__construct();
$this->admin_layout->setLayout('template/layout_admission');
$session = $this->session->userdata('admin_session');
if (empty($session) || $session->type != 'admission') {
$this->session->set_flashdata('error', 'Login First');
redirect(base_url() . 'login', 'refresh');
}
function printDoc(){
$siteaddressAPI = "http://127.0.0.1/exam/admission/forms/showResult/41/2/1";
$data = file_get_contents($siteaddressAPI);
echo $data;
}
}
Your Question does not explain exactly what you need.!!! Better you can give your sample code with expected result.
Still I have a solution which might help you in some way.
You can use view template to generate mark-sheet code. For Example:
$mark_sheets = array();
foreach($all_students_data as $student_data){
$mark_sheets[] = $this -> load -> view('marksheet_template', $student_data, TRUE);
}
Here $this -> load -> view()
with third parameter TRUE
will return generated html code and then store it in mark_sheets array.
By this way, you can access all your mark-sheets from $mark_sheets
array.