Adminlte2 + Fullcalendar - problem when integrating both

Asked

Viewed 339 times

0

Good afternoon, guys, okay? So I’m developing a small system with Codeigniter, and for that I’m using the template Adminlte, and now I’m creating the calendar+schedule part and for that I’m using Fullcalendar

$this->template->set('title', 'Lista de Clientes');
$data['clientes'] = $this->model->listar();
$this->template->load('layout', 'clientes_lista.phtml', $data);

Using the Template this way can already generate several views but when trying to use with Fullcalendar it defaults the template and does not display the calendar as I will show below

Template running: inserir a descrição da imagem aqui

Template with the Fullcalendar: inserir a descrição da imagem aqui

The strange thing is that if you load my calendar view in the normal way it opens without problems $this->load->view('calendar_v.php'); my calendar

Using fullcalendar view only: inserir a descrição da imagem aqui

Code of the calendar view:

<!DOCTYPE html>
<html>
    <head>
        <meta charset='utf-8'>
        <link href=' <?php echo base_url(); ?>assets/calendar/fullcalendar.min.css' rel='stylesheet'>
        <link href='<?php echo base_url(); ?>assets/calendar/fullcalendar.print.min.css' rel='stylesheet' media='print'>
        <script src='<?php echo base_url(); ?>assets/calendar/lib/moment.min.js'></script>
        <script src='<?php echo base_url(); ?>assets/calendar/lib/jquery.min.js'></script>
        <script src='<?php echo base_url(); ?>assets/calendar/fullcalendar.min.js'></script>
        <script>

            $(document).ready(function() {
                $.post('<?php echo base_url();?>calendar2/getEvents', function(data){
                    // Console.log para evitar transtornos
                    console.log(data);
                    $('#calendar').fullCalendar({
                        header: {
                            left: 'prev,next today',
                            center: 'title',
                            right: 'month,basicWeek,basicDay'
                        },
                        defaultDate: new Date(),
                        navLinks: true, // can click day/week names to navigate views
                        editable: true,
                        eventLimit: true, // allow "more" link when too many events
                        events: $.parseJSON(data)
                    });
                });
            });
        </script>
        <style>
            body {
                margin: 40px 10px;
                padding: 0;
                font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
                font-size: 14px;
            }
            #calendar {
                max-width: 800px;
                margin: 0 auto;
            }
        </style>
    </head>
    <body>

        <div id='calendar'></div>

    </body>
</html>

Due to my inexperience I can not find the reason for this behavior, I do not know if the Adminlte has any incompatibility as a script or something, also do not know if because in both views(template and calendar) have the tag can generate some problem, Thank you in advance.

Edit: giving a look at the console I found the following error: inserir a descrição da imagem aqui

  • Use <?php echo base_url('assets/calendar/fullcalendar.min.css'); ?>. It’s the right way.

  • Thanks for the help, but continued with the same problem

  • The comment was not intended to solve the problem, it was only for you to know that this method base_url() has to be used the right way ;)

  • there is so yes, thank you.

  • Have you tested if the links are working correctly? What is your base_url()? Is this correct? Make sure the browser is bringing the files correctly. Also make sure the data is being brought in correctly $.post()

  • I found an error giving a look at the console, I edited the question.

  • Can I copy the error text? I can’t open the image.

  • 1

    If I understand correctly, you have two views. One is the template, and the other loads the calendar. You are trying to load the calendar inside the template, but it is empty. If so, edit the question and show how this template loads this view. You’re confused. If what I’ve noticed is correct, you’re trying to load an entire HTML page into another HTML page, and this request $.post doesn’t matter if you do it.

  • @Shutupmagda He has, probably, a database with events and is trying to upload these events via the calendar post - Full Calendar. No Dashboard compatibility problem Adminlte, because according that page, they are integrated. It may be a problem with date format (date is always a problem).

  • @Nottherealhemingway, yes, yes. What is confused is the view that shows the calendar of events. Apparently, he’s not using a template (or not using it correctly), and thinks he needs to create a template <head> inside the view to use the Fullcalendar. In this case, it needs to show the method that calls this calendar (which should be Agenda()) so we know if it’s true.

  • I believe I have found the problem in both documents I am loading the javascript if I remove from the template it opens the calendar within the area of the template a little disfigured only but opens

  • Remove from view, not template. Template should be the same for all views. If it is the same for all, there is no need to reload scripts in them.

  • Problem that if I withdraw from view it does not recognize the script

  • So you’re doing it wrong. There’s no margin for this need to load scripts into the view. No MVC Codeigniter using template the view job is not that. The <head> in the view only when not using template. Or you’re not wearing template, or is using it in the wrong way. Remember: no Codeigniter, when you speak "template", is trying to say that here.

Show 9 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.