I have following code for my header.php file, in the includes folder.
<html>
<head>
<title>Health Mate</title>
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link href="stylesheets/public.css" media="all" rel="stylesheet"/>
</head>
<!-- Some more code-->
</html>
I have pasted favicon.ico in the includes folder itself.Problem is the favicon is not setting up.Also If i redirect user to some site on submit button like yahoo.com . My site is taking favicon of yahoo. Please suggest some solution. Also tell me if favicon needs to be .ico file or it can be .png as well?
You should have necessary path needed to locate your favicon.ico image.
Eg: If your folder is structured this way:
/mysite
/includes
favicon.ico
index.php
If you're going to use it in index.php you should include the necessary path needed like this:
<link rel="icon" href="includes/favicon.ico" type="image/x-icon" />
Note: for checking if your like get the path towards your icon image..
you could check your web page source code using ctrl + u. Then click the href path linked if it displays the image it means your path is correct.
You have to put favicon.ico in to root directory of your website such that anyone can access it by yourdomain.com/favicon.ico. yourdomain.com/includes/favicon.ico will not work without a link tag.
If you can't put the favicon on the root folder for your domain then you have to use this code and change the href attribute to match the path to the favicon relative to the root of your site. i.e. /includes/favicon.ico
<link rel="Shortcut Icon" type="image/ico" href="/includes/favicon.ico">
I would recommend converting the file to an actual .ico using http://www.icoconverter.com/ or some equivalent tool.
Related
I have looked over the code and cant seem to see where the link between the two files is failing. My index page uses the exact same code to link the files and it works fine. When I add the styling in the header of the php/html file it works but otherwise nothing happens.
The reference that you have for the stylesheet is relative to the url of the page you're on.
For example, this:
<link rel="stylesheet" type="text/css" href="style.css">
... says that the stylesheet is at the same path that the page is on. So if the url in the address bar is https://somewebsite/admin/index.php then that page will try to load the stylesheet at https://somewebsite/admin/style.css. If the url is https://somewebsite/index.php then the page will try to load the stylesheet at https://somewebsite/style.css.
If the stylesheet resides at the root of the site then your link tag should look like this:
<link rel="stylesheet" type="text/css" href="/style.css">
This will make your page look for the stylesheet at https://somewebsite/style.css regardless of what the path of the url says.
You should make the right path, right into your css file at
Example:
<link href="assets/css/blabla.css" rel="stylesheet">
Hello I am trying to move back 2 directories.
For example i have a file in my root folder ie: /root/FILE that links this stylesheet successfully with the file location being /root/blog/wp-content/themes/dazzling/inc/css/CSS-FILE.css"
<link href="blog/wp-content/themes/dazzling/inc/css/font-awesome.min.css" rel="stylesheet" type="text/css">
Now I want to link in the same stylesheet in a file located in a folder that is /root/eliquid/includes/FILE and in there and I am attempting to use
<link href="../../blog/wp-content/themes/dazzling/inc/css/font-awesome.min.css" rel="stylesheet" type="text/css">
I also attempted
<link href="../..blog/wp-content/themes/dazzling/inc/css/font-awesome.min.css" rel="stylesheet" type="text/css">
But not sure what im doing wrong! Any help is much appreciated!
Have you tried using an absolute link rather than a relative link? If your CSS file is at http://www.example.com/blog/wp-content/themes/dazzling/inc/css/font-awesome.min.css then you can include it on any page of your website as
<link href="/blog/wp-content/themes/dazzling/inc/css/font-awesome.min.css">
I want to change the favicon of resources html display pages. I mean when i go to the image url i want to see my icon in the title bar not the icon of the server (in my case XAMPP).
Add this to the <head> of your file:
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
make sure that the href link is correct.
Just put an ICO file named favicon.ico in document root.
A quick test is to open the URL http://my.domain/favicon.ico in a browser; it should display the icon.
Note that the icon file MUST be in document root.
If you can't put the file there physically, you could use Apache's mod_alias to map the file to this URL.
This is done by placing the following line in your server's configuration (httpd.conf file):
alias /favicon.ico /path/to/your/images/directory/favicon.ico
use this
<link rel="icon" type="image/ico" href="images/favicon.ico"/>
Read this Blog Article as well
As the other posters have stated, you need to edit your HTML and in the section, add the line to show the favicon you have uploaded.
If you look at the source for this page, the line defining the favicon is this:
<link rel="shortcut icon" href="//cdn.sstatic.net/stackoverflow/img/favicon.ico?v=6cd6089ee7f6">
but the code stated elsewhere here will also work (<link rel="icon" type="image/x-icon" href="favicon.ico"/>)
Many browsers will automatically look for the favicon.ico in the root of the webserver (as Alex Shesterov wrote in a comment)
I asked in another question about how to reference a file in a higher directory, and the answer is:
<?php include('../filethatineed.html');?>
The problem now is that filethatineed.html can't find it's CSS file. If it's in the same directory as my file that includes it, this works fine. But when it and it's reference files are moved to a different directory, those files can't be located anymore. Opening filethatineed.html in a web browser displays it correctly, so the files are in the correct place.
Here's how I reference them currently, as an example:
<link rel="stylesheet" type="text/css" href="header_style.css">
How should I reference them differently to make sure they work when the file is included from another directory?
Reference them by using an absolute or root-relative path.
<link rel="stylesheet" type="text/css" href="header_style.css">
Either (absolute, protocol-less):
<link rel="stylesheet" type="text/css" href="//yourdomain/path/to/css/header_style.css">
or (root-relative):
<link rel="stylesheet" type="text/css" href="/path/to/css/header_style.css">
You will have to set CSS and image paths according to file in which you are using <?php include('../filethatineed.html');?> not to that file that you are including.
OR you can use this
<link rel="stylesheet" type="text/css" href="//example.com/path/to/image/img.jpg" />
You need to give full path of header_style.css
example
<link rel="stylesheet" type="text/css" href="http://foo.com/css/header_style.css">
or whatever your path is.
The client (= the browser) doesn't see nor care whether your HTML comes from an include() or not. All paths will be relative to the directory of the HTML file that the browser is currently pointing to. Hence, any relative paths you use in filethatineed.html will no longer work.
You'd have to use absolute paths as suggested by Alasjo, or change the relative paths.
Is there a way to implement a LESS stylesheet in a codeigniter project without having to rely on sparks and Carabiner?
In the of my view in CI, I place the link to the LESS file, and the LESS.js file directly underneath, however when I view the site, CI doesn't recognize the .LESS file. I've tried using relative paths as well as hardcoding the the file directories directly, however nothing changes. Is there something I should try adding to my config file to load the LESS files properly?
My file structure for the CI project is as follows
application
controllers
views
system
js
less-1.2.2.min.js
plugins.js
css
style.css
style.less
As for my header, its based off of the html5 boilerplate, to save space I'll only include the relevant info.
application -> views -> layout.php
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet/less" type="text/css" media="screen" href="css/style.less">
<script src="js/less-1.2.2.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css">
<!-- end CSS-->
Are you using mod_rewrite in httpd.conf? If so, you need to make sure that .less files are exempted.
RewriteCond %{REQUEST_URI} !(^alocalfarmCI/index\.php|\.png$|\.gif$|\.less$|\.js$|\.css$|/robots
One way to easily tell if this is your problem, type in a non-existent url within your site that ends in .less. If you see CI's error page, that means /index.php/ was inserted in the url.
If you're running with client-side (javascript) LESS, Codeigniter won't be involved in how LESS operates. Be sure that you've set the rel attribute appropriately when you're linking your LESS file in your views and that the less.js file is being loaded correctly.
<link rel="stylesheet/less" type="text/css" href="styles.less">
<script src="less.js" type="text/javascript"></script>