Search code examples
phpmobilebootstrap-4codeigniter-3hmvc

How to load bootstrap on mbile using hmvc codeigniter?


I am making a desktop application for keeping records using PHP codeigniter(HMVC) bootstrap etc and i am using xampp to host it locally and whenever I open the application from my mobile using my pc's ip address the page renders in plain html i have used bootstrap in the code it works fine on my computer but the bootstrap components like nav bar etc are rendered in plain html.I am using hmvc therefore i have made a seperate folder for page layout.

i am using the lastest versions of bootstrap,codeigniter(HMVC)


Solution

  • I know what's the problem here, you are using relative paths to your assets and you shouldn't do that .. you need to use full uri cause accessing it from another ip address will see localhost and resolve it as its own localhost, i hope you got it, what you need to do is:

    <link href="<?= site_url('path_to_bootstrap_css_relative_to_your_fcpath') ?>" rel="stylesheet" type="text/css">
    

    And make sure to set your site_url in your config.php