Redirecting in Codeigniter

Asked

Viewed 825 times

2

I’m developing a project using the framework codeigniter.

In the index which renders the site, I would like to first direct to a folder called 'input', and when clicking on a link in this folder, then enter the folder 'site', which in this case is the default folder.

My question is: If I put one index.html with a redirect in javascript, will not work because the main thing is the php, and if I change the php, will not open the site in the click.

What they suggest to me?

  • I think your question can be improved a little to better understand your situation. Try to explain the context a little. The folders you refer to are the Controllers?

  • In fact, I have a url outside the /site, where the controllers are and etc... And I needed to access it before accessing the site, because it’s an entry page, so when I click in, I would access it...

1 answer

2

For the creation of the modal, do the following:

  1. Pass a parameter to the view indicating whether to display a modal
  2. In the view check the value of this variable, and if the value is positive (true) add the content of the modal;
  3. Use this same variable to add a code javascript to display the modal.

It would look something like this:

  1. On the controller

$this->load->view('minha_view', array('exibirModal' => TRUE));

  1. In view - modal content

<?php
        if ($exibirModal) {
            
    ?>
        <!-- 
          Aqui vai o modal
          Como montar um modal BS: http://getbootstrap.com/javascript/#modals
        -->
        <div id="modal"></div>
    <?php
        }
    ?>

  1. In view - modal display

 <?php
        if ($exibirModal) {
            <!-- Aqui vai o modal -->
    ?>
            <script>
                $('#modal').modal();
            </script>
    <?php
        }
    ?>

That should fill your need.

  • It’s not like that... I think I will do as follows: I will build an auxiliary module, to manage this entry, in it I will assemble only the view, without the rest of the site, and with this I can control the input and redirects...

  • What is the need to pass the user through a screen before the input? Could not display this content in a modal?

  • It would also be an option Richard, but I don’t know how to elaborate on this.. considering that we already have bootstrap installed as well.. I don’t know if it’s gonna be conflict and all

  • Just the opposite, bootstrap would help in the creation of modal

  • Yeah, but I wouldn’t know how.

Browser other questions tagged

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