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
Related
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.
I have a stylesheet link that looks like below:
<link rel="stylesheet" href="/example/get_page.php?location=bla.css" id="main_ss" />
get_page.php just gets a URL using file_get_contents():
if (isset($_GET['location'])) {
echo file_get_contents('/example/styles/' . $_GET['location']);
}
I can see that the stylesheet file is being fetched properly (for example the text of the file is showing in firebug when I expend the link tag) but for some reason it is ignored by the browser. If I just fetch the CSS file directly of course everything works.
The code can be seen here: www.specman-verification.com/example/bla.html
Any leads? I'm at loss here.
Add the Content-type header like this (do this before you output anything):
header("Content-type: text/css");
Your code is just trying to load the script get_page.php. To load the CSS file you need:
<link rel="stylesheet" type="text/css" href="/example/bla.css" />
(or similar depending on the actual path to your CSS file). In other words the href attribute needs to specify the path to your spreadsheet file, not the HTML page file.
You need to do it the right way. I understand what you're doing here. You need a good mechanism to dynamically load external CSS and have the result display normal html in the browser output.
Follow the instructions on this url: http://www.warpconduit.net/2009/05/12/dynamically-load-css-and-js-files-using-php/
This will at least get you to have a mechanism to load external css file with php dynamically. You're definitely missing steps in your code.
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.
I have a option in my Wordpress theme options panel that I made to choose from five different styles. Running Wordpress on localhost if I choose yellow, red, green, blue or black the style is applied correctly and everything works fine. The code I'm using in header.php is this:
<link rel="stylesheet" type="text/css" media="screen"
href="<?php bloginfo('template_directory'); ?>/css/<?php echo get_option('of_cssstyles'); ?>.css" />
But when I install the same theme on the web I get a webpage with absolutly no CSS style, you can see it here: (http://macoverflow.org/p3dra/), as you can see no CSS style is beeing applied.
How to fix this?
The stylesheet you are linking to doesn't exist. You need to upload it to the server or link to somewhere it is uploaded.
edit: going to: http://macoverflow.org/p3dra/wp-content/themes/blankfolio/css/ shows that the stylesheet is actually called "yellow.css", but the page you are linking to is "Yellow.css" note the case of the "y".
Did you upload your stylesheets to the server?
Did you set the permissions on the stylesheet to be readable by apache?
I received the following by looking at the final html codein the finished page:
http://macoverflow.org/p3dra/wp-content/themes/blankfolio/css/Yellow.css
This is not found.
whats he is saying is the file name is caase sensitive so Yellow.css and yellow.css are two different files in the eyes of the apache, they are as different as having one called yellow.css and he other called pink.css , the detail is in the first letter, being a capital.
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?