[eluser]Unknown[/eluser]
Hi all.
This is my first post,i hope its on the right section.
I would like to request some help.
Im using calendar library but im having trouble to send from controller to view.
It works on controller but i would like to use it on view, since i need it inside my view content.
Here is my code.
Controller
Inside controlo_de_actividade.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Controlo_de_actividade extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{
$data = array('title' => '100 Pragas' , 'main_content' => 'controlo_v');
$this->load->view('admin_template', $data);
}
public function calendario($year = null, $month = null) {
$pref = array (
'show_next_prev' => 'TRUE',
'next_prev_url' => site_url('/').'controlo_de_actividade/calendario'
);
//Calling callendar library
$this->load->library('calendar',$pref);
$data['calendar'] = $this->calendar->generate($year, $month);
//This way i call my template view
//$data = array('title' => '100 Pragas' , 'main_content' => 'calendario_v');
//$this->load->view('admin_template', $data);
}
}
My admin template
$main_content is called trough admin_template.php where i would like to be put calendar inside.
Code:
<div class="wrapper"><!-- not needed? up to you: http://camendesign.com/code/developpeurs_sans_frontieres -->
<header>
<?php $this->load->view('includes/admin_header'); ?>
<?php $this->load->view('includes/admin_nav'); ?>
</header>
<article id="pages" class="group">
<section id="loadcontent" class="group">
<?php $this->load->view($main_content); ?>
</section>
</article> <!-- Pages-->
<aside>
<?php $this->load->view('includes/admin_aside'); ?>
</aside>
<footer class="group">
<?php $this->load->view('includes/admin_footer'); ?>
</footer>
</div>
i forgot to post the controller .php that works well calendar library
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Controlo_de_actividade extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{
$data = array('title' => '100 Pragas' , 'main_content' => 'controlo_v');
$this->load->view('admin_template', $data);
}
public function calendario($year = null, $month = null) {
$pref = array (
'show_next_prev' => 'TRUE',
'next_prev_url' => site_url('/').'controlo_de_actividade/calendario'
);
//Calling callendar library
$this->load->library('calendar',$pref);
echo $this->calendar->generate($year, $month);
//Calendar added to $data, "echo $calendar" to see on view
//$data = array('title' => '100 Pragas' , 'main_content' => 'calendario_v');
//$this->load->view('admin_template', $data);
}
}
/* End of file controlo_de_actividade.php */
/* Location: ./application/controllers/controlo_de_actividade.php */
Thank you
João Costa