Codeigniter base_url() difference - codeigniter

What is the difference of this two codes?
Are these codes really all the same?
<link rel="stylesheet" href="<?php echo base_url(); ?>css/bootstrap.css">
<link rel="stylesheet" href="<?php echo base_url("css/bootstrap.css"); ?>">

Yes, the do produce the same result, although I would argue the second line in your example is the best method because it gives you more control when if and when you move to an asset manager of some kind.
Run in latest version of CodeIgniter:
<link rel="stylesheet" href="https://your-domain.org/css/bootstrap.css">
<link rel="stylesheet" href="https://your-domain.org/css/bootstrap.css">

Related

Laravel 5.5 css path is not working under public directory

I have used the following to generate the CSS file:
<link rel="stylesheet" href="{{ asset('public/global/bower_components/bootstrap/dist/css/bootstrap.min.css') }}">
However, I see the css is not loading. From the view source, I see the below code which is not opening (404).
<link rel="stylesheet" href="http://127.0.0.1:8000/public/global/bower_components/bootstrap/dist/css/bootstrap.min.css">
But, if I remove the "public keyword" from the above path, its working.
I'm using php artisan serve in Ubuntu 16.04
<link rel="stylesheet" href="{{ public_path('global/bower_components/bootstrap/dist/css/bootstrap.min.css') }}">
<link rel="stylesheet" href="http://127.0.0.1:8000/global/bower_components/bootstrap/dist/css/bootstrap.min.css">
these two works. Because when 127.0.0.1:8000 load, it starts making the project from public path.
and asset(/path) is represent asset folder. You must change this with public_path
You can use asset() helper,
<link href="{{ asset('public/global/bower_components/bootstrap/dist/css/bootstrap.min.css') }}" type="text/css" rel="stylesheet">

Laravel linking assets files to root of domain but not subfolder that the site is in

I have a site that is www.project.example.com/apps/myapp and I have various javascript and css files linked like this
<link rel="stylesheet" type="text/css" href="{{asset('/css/app.css')}}"/>
<link rel="stylesheet" type="text/css" href="{{asset('/css/myapp.css')}}"/>
<script type="text/javascript" src="{{asset('js/app.js')}}"></script>
<script type="text/javascript" src="{{asset('js/vendor.js')}}"></script>
But I keep getting a 404 not found error because its looking for the files in www.project.example.com/css for example.. Its not even looking in the assets folder
How can I fix this without having to change the path for every css and javascript file?
fixed it. had to set base href in index.php and use relative links
<base href="/apps/myapp/"
<link rel="stylesheet" type="text/css" href="css/app.css'"/>
<link rel="stylesheet" type="text/css" href="css/myapp.css"/>

How do i call css file in laravel?

Good day. I'm trying to call css in laravel. Here is the css url
<link rel="stylesheet" href="http://localhost:84/mycms/public/css/index.css">
It's working fine.
Then I'm trying the laravel way with this https://stackoverflow.com/a/16565640/6354277 . And i change it to this
<link rel="stylesheet" href="{{ URL::asset(css/index.css') }}">
It Seems i can't found the css file. How can i fix it ?
You may try this.
My css file is in public/css/sample.css
It works fine
<link href="{{ asset('css/sample.css') }}" rel="stylesheet" >

Joomla Web page rel="canonical"

I need help to modify this rel="canonical" below to automatically pick up the url of the page, I have SEF turned on and using Joomla .htacces
<link rel="canonical" href="http://www.yourwebsite.com<?php echo $_SERVER['PHP_SELF']; ?>" />
this statement gets me the site's main url.
thanks
Use: JURI::current()
In your code:
<link rel="canonical" href="<?php echo JURI::current(); ?>" />

mageintern shop login extension magento Issues

I am using the mageintern shop login magento extension. Simply i have installed it, enable it from admin, can see also in front-end, but where its css. Any suggestion ??
Any help would be appreciative. Kindly guide me please.
Thanks
JS
Its works ! I have change 33 line number in shoplogin_page.phtml
<link rel="stylesheet" type="text/css" href="<?php echo($this->getSkinUrl('css/shoplogin.css')) ?>" media="all" />
it works for me
same changes
<link rel="stylesheet" type="text/css" href="<?php
echo($this->getSkinUrl('css/shoplogin.css')) ?>" media="all" />

Resources