When I include the following code within my view file:
<link rel="stylesheet" href="<?php echo base_url();>css/libs/animate.min.css" type="text/css" media="all">
<!-- Font Awesome icon library -->
<link href="<?php echo base_url();?>css/libs/font-awesome.min.css" rel="stylesheet" type="text/css" media="all">
<!-- Load primary stylesheet -->
<link rel="<?php echo base_url();?>stylesheet" href="css/skin.css" type="text/css" media="all">
Nothing loads not even HTML content,
but when I remove these lines HTML content loads properly.
So how do I load my CSS files? They are in my assests/css
You have to load helper in config/autoload.php
$autoload['helper'] = array('url', 'file','form');
in config.php]
$autoload['helper'] = array('url');
and base_url() should
$config['base_url'] = '';
you did mistaken to close the php script in first css linking
you wrote .
<?php echo base_url();>
instead of
<?php echo base_url();?>
and also check that you have loaded url helper in your code or not ?
use this
<link rel="stylesheet" href="<?php echo base_url();?>css/libs/animate.min.css" type="text/css" media="all">//mistake in this line missing '?'
<!-- Font Awesome icon library -->
<link href="<?php echo base_url();?>css/libs/font-awesome.min.css" rel="stylesheet" type="text/css" media="all">
<!-- Load primary stylesheet -->
<link rel="<?php echo base_url();?>stylesheet" href="css/skin.css" type="text/css" media="all">
Related
I am trying to change the default style based on title of the page.I found that as the easiest way to accomplish needs.
I load the default styling option in header.php file:
<link rel="stylesheet" data-them="" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="all" />
I suppose <?php bloginfo('stylesheet_url'); ?> loads style.css which is on same path as header.php
I commented out this the line <link rel="stylesheet" data-them="" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="all" /> and tried to check title with php, based on that condition I wanted to load different style.css file.
<?php
$title = get_the_title();
if($title === "Title1"){
?><link rel="stylesheet" data-them="" href="style.css" type="text/css" media="all" /><?php
}
elseif($title === "Title2"){
?><link rel="stylesheet" data-them="" href="style2.css" type="text/css" media="all" /><?php
}
else{
?><link rel="stylesheet" data-them="" href="style3.css" type="text/css" media="all" /><?php
}
?>
This code does not work for me and not sure why.. Styling is messed up
Please find below style in your theme. Mostly enqueue in functions.php file.
EX:
wp_enqueue_style( 'twentynineteen-style', get_stylesheet_uri(), array(),
wp_get_theme()->get( 'Version' ) );
Please add below line after your theme's default style.
(get_stylesheet_uri())
wp_dequeue_style('twentynineteen-style');
After that check it your issue.
Please dequeue default style using below function.
wp_dequeue_style('default-style');
I am having trouble with applying CSS style in my view.
I have set base_url in config.php also..
config['base_url']='http://localhost/test_project/'
My code is
<html>
<head>
<title>Untitled Document</title>
<link type="text/css" href="<?php echo base_url()?> css/mycss.css" >
</link>
</head>
<body>
<p> This is test.</p>
</body>
</html>
My CSS code is
p
{
color:#0066CC;
}
But it shows only simple text..
How to apply CSS in codeigniter....
Put the path inside the function. Include rel="stylesheet" in the link tag. You don't need the closing </link> either.
<link rel="stylesheet" type="text/css" href="<?php echo base_url('css/mycss.css'); ?>">
View the source of the page, you should see the CSS included like this
<link rel="stylesheet" type="text/css" href="http://localhost/test_project/css/mycss.css">
You need put in html tag link the attribute rel="stylesheet"
<link type="text/css" href="<?php echo base_url('css/mycss.css') ?>" rel="stylesheet" >
Check with your firebug if your css files is load fine.
You could use html tag called "base" for example:
<base href="http://url" />
In your code:
<html>
<head>
<title>Untitled Document</title>
<base href="<?php echo base_url()?>" />
<link type="text/css" href="css/mycss.css" rel="stylesheet"></link>
</head>
<body>
<p> This is test.</p>
</body>
</html>
I use the default function of codeigniter. For example:
echo link_tag('assets/css/bootstrap.css');
Hi Guys I have been tasked with moving a custom framework from joomla 1.5 to 3.0 I have gotten the framework to load the homepage perfectly however when I go to other pages the css wont load here is the code:
PHP:
<link rel="stylesheet" href="<?php echo $this->baseurl(); ? >templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl(); ?>templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/addons.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/layout.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/template.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/typo.css" type="text/css" />
HTML Output:
<link rel="stylesheet" href="http://flyvail/index.php/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="http://flyvail/index.php/templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/addons.css" type="text/css" />
<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/layout.css" type="text/css" />
<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/template.css" type="text/css" />
<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/typo.css" type="text/css" />
<!-- CSS for handheld devices -->
<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/handheld/layout.css" type="text/css" />
<link rel="stylesheet" href="http://flyvail/index.php/templates/FlyVail2/css/handheld/template.css" type="text/css" />
<!-- CSS for handheld devices -->
<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/handheld/layout.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->templateurl(); ?>/css/handheld/template.css" type="text/css" />
<!-- //CSS for handheld devices -->
I am not sure why it isn't loading right
Assuming this is in your template's index.php file, then try:
$doc = JFactory::getDocument();
$doc->addStyleSheet($this->baseurl.'/templates/'.$this->template . '/css/NAMEOFSTYLESHEET.css', $type = 'text/css', $media = 'screen,projection');
to add your style sheets instead.
My guess is that $this->baseurl() does not work with the () as it is a parameter, not a function. As such, your link is shown without the baseurl is generated by a relative link which also takes into account the base href that joomla sets. This means when you are not in the root of the site, it the link is wrong.
(Your code would probably work if you just removed all the ()s, but the addStyleSheet method is better practise)
If that doesn't work, can you take a look to see if the URL generated is different on your homepage where you say it works and the sub-page where you say it does not, and add this additional info to your question.
Stylesheet is loading for codeigniter adminpanel.
But my style css file is not applying for adminpanel.
I have added stylesheet as follows and the adminpanel url is http://www.xyz.com/demo/admin.
<link href='<?php echo base_url(); ?>assets/css/uploadify.css' rel='stylesheet' type="text/css">
$this->config->set_item('base_url', 'http://www.xyz.com/demo/admin');
<link href='<?php echo base_url(); ?>assets/css/uploadify.css' rel='stylesheet' type="text/css">
You need to load url helper to use url function
$this->load->helper('url');
<link href='<?php echo base_url(); ?>/assets/css/uploadify.css' rel='stylesheet' type="text/css">
I'm new to code igniter and I wonder why my css doesn't work when I add slash ( / ) at the end of the url ..
Can someone help me why it doesn't work ? And help me make it work ?
Try this add code to your html head:
<link rel="stylesheet" href="<?php echo site_url('css/style.css');?>" type="text/css"/>
or
<link rel="stylesheet" href="<?php echo base_url();?>css/style.css" type="text/css"/>
CodeIgniter has method: site_url() - which generates your home url with '/' (slash) at the end.
To access public assets of your application
use this:
<link type="text/css" rel="stylesheet" href="<?php echo site_url(); ?>public/css/smoothness/jquery-ui-1.10.2.custom.min.css">
<script type="text/javascript" src="<?php echo site_url(); ?>public/js/custom.modernizr.js"></script>
Note: href="<?php echo site_url(); ?>public/css/smoothness/jquery-ui-1.10.2.custom.min.css"