I try to make this style.css loading works:
site/views/header.php
<link rel='stylesheet' id='rs-plugin-inline-css' href='<?php echo base_url(); ?>assets1/css/slider/settings-inline.css' type='text/css' media='all' />
<!--style css-->
<link rel='stylesheet' id='yith-wcwl-main-css' href='<?php echo base_url(); ?>assets1/css/style.css' type='text/css' media='all' />
site/config/config.php
$config['base_url'] = 'http://localhost/masterlinkci2/';
I test this in the url: http://localhost/masterlinkci2/assets1/css/style.css
I wonder why: Object not found!
I have that file in: masterlinkci2/assets1/css/style.css
This does not works out either:
<!--style css-->
<link rel='stylesheet' id='yith-wcwl-main-css' href="<?php echo base_url('assets1/css/style.css'); ?>" type='text/css' media='all' />
Do I need to configure the router as well?
First of all load url helper like this.You can load helper either in controller or in application/config/autoload.php.
$this->load->helper('url');
Then try like this...
<link rel='stylesheet' id='yith-wcwl-main-css' href="<?php echo base_url('assets1/css/style.css');?>" type='text/css' media='all' />
For more see here https://www.codeigniter.com/user_guide/helpers/url_helper.html
I probably think you have not setup your url rewrite with .htaccess. I would recommend you setup URL rewrite and try with:
<link rel='stylesheet' href='<?= base_url("assets1/css/style.css") ?>' />
Or if are not planning to use URL rewrite then add index.php in your path. Like
<link rel='stylesheet' href='<?= base_url("index.php/assets1/css/style.css") ?>' />
Check this for URL rewrite
Your Base Url :
$config['base_url'] = 'http://localhost/project/';
Your CSS:
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/style.css" type="text/css" />
Hope this works.
remove index from congif:
$config['index_page'] = '';
And Change the .htaccess file as give below. add this code.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
It works fine for me.
I don't sure about removing index is the best practice but it makes lot's of work easier. so I have done that. do what your mind say.
Try your stylesheet link like this
<link rel="stylesheet" href="<?php echo base_url('assets1/css/style.css');?>" media="screen">
Your URL needs to be inside the ()
Related
I am new in laravel so i doing a project in laravel .I need to update a record so when i load the edit form then js and css path are corrupted if i don't pass update id among the url then there is no problem.
Below is my code
edit url is
Edit
web.php
Route::get('/editmarriagepackage/{id}','AdminController#editmarriagepackage');
Admincontroller.php
public function editmarriagepackage($id){
$data['action']='/updatemarriagepackage';
return view('admin.Addmarriagepackage',$data);
}
header.php
<!-- CSS Files -->
<link href="assets/css/material-dashboard2.min.css" rel="stylesheet" />
<!-- CSS Just for demo purpose, don't include it in your project -->
<link href="assets/demo/demo.css" rel="stylesheet" />
The problem is css and js path is appear as http://127.0.0.1:8000/editmarriagepackage/assets/css/material-dashboard2.min.css and http://127.0.0.1:8000/editmarriagepackage/assets/demo/demo.css
Here "editmarriagepackage" is unwanted.Actual path must be http://127.0.0.1:8000/assets/css/material-dashboard2.min.css if it is this then no problem.This issue not occurs when i use Route::get('/editmarriagepackage','AdminController#editmarriagepackage');
so the problem is when i pass id through url then function name in the controller is appeared in css and js path
In your views you have to generate static assets files with the asset helper.
This generate the correct path based on the document_root.
So, assuming the file(s)/folder(s) are placed in the public folder:
Without Blade
<!-- CSS Files -->
<link href="<?php echo asset('assets/css/material-dashboard2.min.css'); ?>" rel="stylesheet" />
<!-- CSS Just for demo purpose, don't include it in your project -->
<link href="<?php echo asset('assets/demo/demo.css'); ?>" rel="stylesheet" />
With Blade (recommended)
<!-- CSS Files -->
<link href="{{ asset('assets/css/material-dashboard2.min.css') }}" rel="stylesheet" />
<!-- CSS Just for demo purpose, don't include it in your project -->
<link href="{{ asset('assets/demo/demo.css') }}" rel="stylesheet" />
CSS File path is true but still couldn't found..
CSS File Path;
public/assets/demo/default/base/style.bundle.css
In Blade;
<link href="{{asset('assets/demo/default/base/style.bundle.css')}}" rel="stylesheet" type="text/css" />
Where do I mistake ?
the second assets shouldn't be needed if your css is in resources/assets.
<link href="{{asset('demo/default/base/style.bundle.css')}}" rel="stylesheet" type="text/css" />
i use sub folder in controller like admin_panel
in admin_panel / main.php i use this code
public function index()
{
$h_data['title'] = 'admin';
$c_data = array();
$this->parser->parse('admin/head',$h_data);
$this->parser->parse('admin/index',$c_data);
}
and head.php in view/admin contain :
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../assets/css/font.css" type="text/css" />
<link rel="stylesheet" href="../assets/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../assets/css/bootstrap-responsive.css" rel="stylesheet">
<link rel="stylesheet" href="../assets/css/bootstrap-theme.min.css" type="text/css" />
<!-- HTML5 shim for IE backwards compatibility -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="../assets/css/admin_style.css" />
<script type="text/javascript" src="../assets/js/jquery.min.js"></script>
<script type="text/javascript" src="../assets/js/bootstrap.min.js"></script>
<title> {title} </title>
</head>
asstes folder exist in root project but when refresh page all head tags return 404 and not found ???
You could try
public function index() {
// Load Parser library or autoload it.
$this->load->library('parser');
$data['title'] = "Page Title";
$data['base_url'] = base_url(); // Make sure you add url helper to autoload.
// May need to add true, i.e $this->parser->parse('header', $data, true);
$data['header'] = $this->parser->parse('header', $data);
// May need to add true, i.e $this->parser->parse('footer', NULL, true); Null No Data
$data['footer'] = $this->parser->parse('footer');
$this->parser->parse('content', $data);
}
On Content View Area's
<?php echo $header;?>
Content
<?php echo $footer;?>
Header View Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<title><?php echo $title;?></title>
<base href="<?php echo base_url();?>"></base>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/admin/css/bootstrap.css" media="screen">
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/admin/css/custom.css" media="screen">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/admin/js/common.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/admin/js/filemanager.js"></script>
</head>
<body>
Footer View Example
<footer id="footer">
<br />
</footer>
</div>
<script type="text/javascript" src="<?php echo base_url();?>assets/admin/js/bootstrap.min.js"></script>
</body>
</html>
Auto load url helper
$autoload['helper'] = array(
'url',
'file',
'form',
'text',
'html',
'date'
);
i find answer this error occure for .htaccess not suitable code . i use this htaccess and work fine :)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
I'm working with a Joomla website, is not the first time that I use the LESS CSS, but this time I don't know why this is not working.
I've downloaded the last less.js from the website and I insert this before the end of tag HEAD, I call the CSS
before the js, like this:
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/main.css" type="text/css" />
<link rel="stylesheet/less" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/css/style.less" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/css/templateskit.css" type="text/css" />
<script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/js/less-1.5.0.min.js"></script>
If I check in the code of my website I see that the path is correct and I can see the code correctly, but the browser don't read the less css and I don't know why!
(Solution moved from question to answer)
There was a box-shadow property present in my LESS file; that was what gave me this problem! Removing it fixed it.
We have a multistore setup in Magento - well, a two-store setup:
English for USD transactions and,
English for CAD transactions
The "en" store goes with the default URL — i.e. domain.com/
The "en-ca" store is setup as a subfolder — i.e. domain.com/ca/
The product/category URLs are all the same, they're merely appended at the end of the above store URLs.
We need to add the following tags:
<link rel="alternate" hreflang="en" href="http://domain.com/" />
<link rel="alternate" hreflang="en-ca" href="http://domain.com/ca/" />
where the product/category urls are appended to the store domains in the href tag.
For a Product URL: domain.com/product-name.html the above tags should become:
<link rel="alternate" hreflang="en" href="http://domain.com/product-name.html" />
<link rel="alternate" hreflang="en-ca" href="http://domain.com/ca/product-name.html" />
For a Category url: domain.com/category1/subcategory2/ the above tags should become:
<link rel="alternate" hreflang="en" href="http://domain.com/category1/subcategory2/" />
<link rel="alternate" hreflang="en-ca" href="http://domain.com/ca/category1/subcategory2/" />
What needs to be added to the template header .phtml files in order to get these output correctly for each product or category page, please?
Try putting this in your header file:
<?php $url = str_replace(".com",".com/ca" , Mage::helper('core/url')->getCurrentUrl()); ?>
<link href="<?php echo $url; ?>" hreflang="en-CA" rel="alternate" />
<?php $url = str_replace(".com/ca",".com" , Mage::helper('core/url')->getCurrentUrl()); ?>
<link href="<?php echo $url; ?>" hreflang="en" rel="alternate" />
It will generate the hreflang URL for you.