Welcome Guest, Not a member yet? Register   Sign In
unable to connect with CSS using base_URL and link_tag()
#11

I have tried this and it works for me.
I do have the base url set in the config

$config['base_url'] = 'http://ci3.local/';
On the package it said needs Windows 7 or better. So I installed Linux.
Reply
#12

(This post was last modified: 06-16-2017, 12:46 PM by skunkbad.)

Yeah, your base_url in config/config must be prefixed with http:// or https://
Reply
#13

Thanks all... issue resolved with the following code
$config['base_url'] = 'http://localhost/ciblog/';
Reply
#14

(This post was last modified: 06-19-2017, 11:16 PM by wolfgang1983.)

(06-15-2017, 02:33 PM)hafizfarooq Wrote: I am trying to connect with my CSS using link_tag() but system is not connecting... no errors .. nothing happens

Code:
<!DOCTYPE html>
<html>
   <head>
       <meta charset="UTF-8">
       <title>Articles List</title>
       <?= link_tag('assets/css/bootstrap.min.css') ?>
   </head>
   <body>
       <h1>Hellooooo</h1>
   </body>
</html>

in controller
PHP Code:
<?php
    class User 
extends MY_Controller
    
{
 
       public function index()
 
       {
 
           $this->load->helper('html');
 
           $this->load->view('public/articleslist');
 
       }
 
   }
?>

please help...
Farooq

Make sure you have set your base url with http://


PHP Code:
$config['base_url'] = 'http://localhost/projectname/'

Make sure also assets out side of application folder.  php echo 

And the use <?php echo link_tag('assets/css/bootstrap.min.css'); ?>
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#15

(This post was last modified: 09-09-2019, 09:22 PM by ciadmin.)

(06-15-2017, 02:33 PM)hafizfarooq Wrote: I am trying to connect with my CSS using link_tag() but system is not connecting... no errors .. nothing happens

Code:
<!DOCTYPE html>
<html>
   <head>
       <meta charset="UTF-8">
       <title>Articles List</title>
       <?= link_tag('assets/css/bootstrap.min.css') ?>
   </head>
   <body>
       <h1>Hellooooo</h1>
   </body>
</html>

in controller
PHP Code:
<?php
    class User 
extends MY_Controller
    
{
 
       public function index()
 
       {
 
           $this->load->helper('html');
 
           $this->load->view('public/articleslist');
 
       }
 
   }
?>

please help...
Farooq

That mistake is only permissions
Reply
#16

Try viewing the source code of the  rendered HTML page and note the echoed PHP string:

<?= link_tag('/assets/css/bootstrap.min.css') ?>
Reply




Theme © iAndrew 2016 - Forum software by © MyBB