base_url of Codeigniter 3 changing css call link and js

1

Good afternoon, everyone! I'm making a site with an inscription page that uses codeigniter and bootstrap, but I'm having a problem:

CSS and JS load normally, but when I sign up and redirect the page to appear a success message, all CSS and JS are no longer called in the right place and the page unconfigures.

Eg the css file should be loaded via the following link:

"h ttp: //localhost/teste/assets/css/inscricao.css"

But when the redirect is done, it will be called in the following link:

" link "

That is, it is no longer called in the correct location. And where did "/ inscription /" appear in the middle of the link, in the file call, so out of nowhere?

I'm using the base_url () function, which is set up as follows:

    $config['base_url'] = 'http://localhost/teste/';

No html:

    <link href="<?php base_url(); ?>assets/css/inscricao.css" rel="stylesheet">

DETAIL : if in html I take out base_url (); and instead put directly link ", this problem will not happen.

OBS : This redirection I do is through the Codeigniter Routing URI.

Driver Code :

    <?php
    defined('BASEPATH') OR exit('No direct script access allowed');

    class Inscricao extends CI_Controller {

        public function index($indice=null)
        {
            $this->load->view('estrutura/header');
            $this->load->view('estrutura/menu');

            if($indice==1){
                $this->load->view('estrutura/msg_sucesso');
            } else if($indice==2){
                $this->load->view('estrutura/msg_erro');
            }

            $this->load->view('inscricao');
            $this->load->view('estrutura/footer');
        }

            public function inscrever(){
                $data['nome'] = $this->input->post('nome');
                $data['email'] = $this->input->post('email');

               if($this->db->insert('alunos',$data)){
                      redirect('inscricao/1');
               } else{
                   redirect('inscricao/2');
               }
           }
    }

In the "routes.php" file, it looks like this:

    $route['inscricao/(:num)'] = 'inscricao/index/$1';

Someone who can help me, please? What is wrong? Thank you, from now, who can help! = D

    
asked by anonymous 17.05.2017 / 19:30

1 answer

1

Hello, try this:

$ config ['base_url'] = '';

or

$ config ['base_url'] = ' link '

and put an echo in base_url:
echo base_url ('assets / css / inscricao.css');

    
17.05.2017 / 23:02