favicon disappears - php

Why the favicon disappears
Background:
I have my site made according to mvc
So, I will have a frontcontroller and a main layout
All the other views will be loaded in the $content variable from the main layout.
The main layout holds the tags withe the link rel "shortcut favicon".
The favicon disappears when I klik on a link in a child view.
This happens with firefox.
IE is ok, but is more persistant anyway, even if you want to get rid of it.
So, in short, - is there an explanation for this, maybe?

Try
<link rel="shortcut icon" href="/favicon.ico" >
to make sure you are always pointing to the web root.

Do all the resulting HTML pages in your child view contain the proper <link> tag for your favicon?
Does the link tag's href reference an absolute path?
Could it be that you visited your child view's output before your favicon existed, and your missing favicon is actually being cached?

Related

How to check if my html will print longer than one page?

I was wondering if there was a way using php or javascript to see if my webpage will be longer than one page when printed. I have specific elements that need to be at the bottom of the page regardless of how long the content in the middle of the page is, (max one page including footer).
Tried various css elements such as bottom.
Have you tried making a separate 'print.css' file that only alters the way a page looks when it is going to be printed? <link rel="stylesheet" type="text/css" href="print.css" media="print">. This can also be done with an #media print { } tag in your regular css file.

what is the meaning of the following line in php smarty?

I'm new to smarty and I'm seeing this line
<link rel="shortcut icon" href="
{$system['system_url']}/themes/{$system['theme']}/images/favicon.png" />
This line is used to set favicon but they can use direct the image url "images/favicon.png" so why they used
It is a best practice to isolate different resources as much as possible. Referencing a static file such as a favicon directly creates a direct link between the web framework and web layout.
Using the types of variables you see in your example, makes the path address to the favicon dynamic so if the app where to be moved, or renamed, the links between layout and framework would still work without needing to manually change all path addresses.

HTML - set favicon

I set an icon like that:
<link rel="icon" type="image/x-icon" href="/media/icon.ico">
<link rel="shortcut icon" type="image/x-icon" href="/media/icon.ico">
and I also tried this:
<link href="/media/icon.ico" rel="shortcut icon" type="image/x-icon" />
It works only in some parts of my website, but I don't know what I'm doing wrong. Is there something that I have to consider?
I use PHP and HTML. I don't know if it's coincidence or not, but it works with every HTML file and only with some of the PHP files.
Can anybody help me?
shivan
You'll need to make sure the URL (href) is valid for the page you are viewing.
Remember / is site level (/media/icon.ico = http://yourdomain.com/media/icon.ico).
Also make sure it is a valid .ico file. I recommend trying a .jpg file instead. (.png, .jpg, .gif and .ico are all valid favicon formats)
As well, depending on the icon size, it may not work in all browsers.
16x16 is the recommend size for favicons, but 32x32 may work as well.
Here is a link that should tell you everything about favicons: http://perishablepress.com/everything-you-ever-wanted-to-know-about-favicons/
If it only appears for your html pages and not your php ones, then you may be adding the link tag incorrectly or it may also be missing.
I suggest you use the developer tools of your browser (right-click anywhere on your page and choose Inspect Element - Chrome, Firefox) when you're on your php pages and check if you see the tag added correctly having the exact same path set there as in your html pages. Using developer tools you should also be able to hover over the link and it would tell you if the image existed or not.
I bet the path will be incorrect somehow depending on the placement of your php files versus the html ones and the icon.
Try accessing those pages from another browser. Also, try accessing them from a browser in incognito/private mode.
If you do see the favicon, try cleaning your browser's cache - it could be that something is left over from the last time you browse those pages (i.e. before you added the favicon to the HTML).
I had trouble getting this to work for me without using a direct link.
For example on my site: http://adamgressen.com/
I reference the image with a direct link:
<LINK rel="SHORTCUT ICON" href="http://adamgressen.com/favicon.ico">
You definitely want to clear your cache if you're testing locally because you may not see the changes for a while otherwise.

Codeigniter not displaying stylsheet when clicking on links

I just built a sit in Codeigniter, but when I click on a menu item the stylesheet breaks and it displays all of the content broken out on the page.
http://marciabrownproductions.com/
I uploaded it to a test server and all the links works perfectly.But when I uploaded the finished site ot my clients server the css issue starts. Is there something wrong with my clients server? Or is there a problem with how I coded the site? Why does it work on one server, but not the other.
Thanks!
First, I recommend using absolute paths instead of relative paths when referencing your assets. At the moment, they are being picked up with the index.php included.
So, let's say your link is http://domain.tld/index.php/home/actors, you should be calling your assets from their actual URLs - http://domain.tld/index.php/_/css/style.css would not work, for example. http://domain.tld/_/css/style.css, however, would work. (That's just a sample URL.)
I'd also recommend removing the index.php from your links, simply by using the htaccess RewriteEngine, and removing index.php from your app's config file.
Have a look at how your current source is being generated in a browser (right-click, View Source) to see what I mean.
Update:
Based on your comment, that may be an htaccess issue. Check to see if your hosting provider supports it.
In the meantime, put the index.php back in the app's main config file. However, leave your CSS asset link as it is. Make sure all your asset links look like this:
<link href="http://marciabrownproductions.com/_/css/styles.css" rel="stylesheet" type="text/css" />
<script type='text/javascript' src='http://marciabrownproductions.com/_/js/jquery.validate.js'></script>
<script type='text/javascript' src='http://marciabrownproductions.com/_/js/effects.js'></script>
<link href="http://marciabrownproductions.com/_/css/bjqs.css" rel="stylesheet" type="text/css" media="screen" />
<script src="http://marciabrownproductions.com/_/js/bjqs-1.3.js"></script>
Your images are broken because their links are also including the index.php/home. You need to make sure that that is taken out. (What are you using to generate your links anyway?)

Editing PixelPost Template

I've installed PixelPost (http://www.pixelpost.org/) photo blog script , and I'm using a template which has two CSS files , [Dark + Light] ,
The problem is here ; How should I make the dark CSS style default , in the file "browse_template" it has the following codes :
<link rel="stylesheet" type="text/css" href="templates/simple/styles/dark.css" title="dark" />
<link rel="alternate stylesheet" type="text/css" href="templates/simple/styles/light.css" title="light" />
which was vice versa , I mean the Alternate stylesheet was dark , I did change this to the above code but still the light style is defualt
here's the full template : Template Link
I'm not sure to understand correctly your question but i'll try to explain.
Everything happens on styleswitcher.js
At first load (never seen the page):
The js file will determine your "favourite" stylesheet following these conditions :
It's a <link> tag containing rel=*style*
It does NOT contain "alt" string in rel attribute.
It has a title attribute.
So ! With your code, the "dark" theme will be selected at first start.
When you leave the page, the js file is saving the selected favourite style into a cookie.
On next loads
The JS file is reading the previously saved cookie and show the last saved style by priority.
If you want to check the correct behaviour of your script, you must delete cookies on this domain, then refresh the page. It should see the "Dark" style at first.
Another option to check is to run your Chrome/Firefox in private browsing mode
Hope this solves your issue

Categories