PLEASE CAN SOMEONE HELP: CSS works in preview but not when uploaded to the server!!

They have: 3 posts

Joined: Dec 2008

Can someone please help!!!!! My husband's getting in a right state and typically... he doesn't like to ask for help! I'm NOT a web developer/designer but as I understand it, this is the problem:

Background: He's creating a content managed site. Someone else has created the PHP Progamme (which he is assured is working on the server) and he's doing the design. He's created layouts using CSS (SPRI menus - which he's new to) and they look good and work well when he previews them in the brower. However, when he uploads the site to the server it doesn't work! He thinks it's something to do with uploading them with PHP (which he hasn't done before). Can anyone possibly help with any advice in anyway before he has a breakdown!!! (from his loving, neurotic wife):0

All the best, Joe

greg's picture

He has: 1,581 posts

Joined: Nov 2005

Firstly, welcome to TWF Smiling

Secondly, it could be a number of things really, but, the good thing is we will get to the bottom of it quickly with a bit more info...

When you say "they look good and work well when he previews them in the browser", are these files that are ok in the browser just loaded from your pc?
As you cannot view a php file in a browser from your PC (they need a php server to run, which you may have) do they have the exact same code in them when they are loaded into the server? Or are you viewing only html/css on your pc then adding that html/css to a php file before uploading to the server?

In your FTP program, in the folder where the files are that don't work, is there an error_log file? Or are errors displaying on the screen?

We can help, but you need to give us a bit more info about what he's doing, any differences or changes to anything between when the files do work and when they are uploaded and dont (I.E. code added etc)

Maybe your husband needs to write here and explain, save you being inbetween. It really isn't a problem you requiring some assistance, even advanced coders need advice and help from time to time.

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Very often these kind of problems, not including a file such as a css stylesheet, are due to an incorrect path to the file, especially if the path is generated by a PHP script... Check the path, try using an absolute path (http://thedomain/pathtofile) rather than a relative one (/pathtofile)

What are "SPRI menus"? I tried a Google search with no results.

Someone else has created the PHP Progamme (which he is assured is working on the server) and he's doing the design.

Why use an untested CMS?

I would recommend Drupal

Some (but not I) prefer Joomla!

Or you can pick from dozens of others demoed at opensourcecms.com

greg's picture

He has: 1,581 posts

Joined: Nov 2005

decibel.places wrote:
Very often these kind of problems, not including a file such as a css stylesheet, are due to an incorrect path to the file, especially if the path is generated by a PHP script.

I asked for more info as it could be hundreds of reasons.
Before we can try to help, we really need to know what the issues/errors are, otherwise we could spend days guessing.. incompatible PHP versions to his scripts, badly placed code in a file, incorrect PHP syntax, wrong file/folder references somewhere, bad links to pages in html/php, something wrong in the htaccess, badly configured server, other hosting issues, nameserver issues, dns issues, mysql issues

The list is endless, and is why we need to find more out regarding what's happening (or not happening) etc before trying to diognose, and definately not trying to guess what it might be without a clue to the actual issues.
We don't even know if the site is displaying anything or not, or if it displays the content but not as it should be, etc

Also, why might he want to use drupal or joomla? You don't know what his content or requirements are?

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

greg wrote:

I asked for more info as it could be hundreds of reasons.

Greg, my suggestion was not a criticism of your troubleshooting process, just an observation of the most common cause for files not displaying in my own experience. Wink

I often debug by putting a print_r statement in a php file, or set a selector to background: red in a CSS stylesheet just to make sure I am on the target.

greg wrote:
Also, why might he want to use drupal or joomla? You don't know what his content or requirements are?

Drupal and Joomla! are very stable CMSs with good support communities. It sounds like OP's husband is using some kind of home-grown CMS created by a buddy, and that makes it a potential problem, compared with the tried-and-true. I also pointed to OpenSourceCMS for other selections.

They have: 3 posts

Joined: Dec 2008

Hi

Hubby here. First, Thank you for all the responses to my wife's plea for help. I thought I should clarify my problem as there are so many bits of advice coming back and a number of different levels.

Secondly: I am a Mac person - I'm not that familiar with PCs - I am a designer, not a coder - I rely heavily on wysiwyg and previews to know whether code changes are working.

I have created templated files in DW using a css layout based on a DW starter layout (not a DW html starter page). This is the first time I have used a css layout based on divs rather than html tables.

My coder is a php person whom has kindly set up a simple database driven cms which we have seen working fine on the server. I.E. you can access the various pages through the cms and upload changes. So we got that far!

The problems started to occur when I looked at the pages online for the first time and noticed a number of what I would describe as design positioning errors on all the pages, suggesting that the template needed to be tweaked. Given that I had had the design as I wanted it locally before uploading my files to the server, I assumed this was something he (the coder) had done. Sure enough, he confirmed that he'd set up a new 'master' css. His attitude was: well, if it's not right, then change it in the template. A bit of a pain as I thought I'd done all that!

What has followed is a disastrous sequence of confused attempts on my part to 'learn' css and to try to gain the same level of control of the div system as I am used to with html tables. It seems that however good the layout looks in firefox or safari, it stinks in IE. Get it looking right in IE and the elements are all over the place in DW and it looks lousy in other browsers.

The position now is that I have completely redone the template as simply and cleanly as I can, and applied it to the pages of the site. I have made sure that the php call in the code is where it should be, although it will need to be redefined for each page so that it calls the relevant content (currently a fatal error).

The current major issue is that the navigation doesn't properly work in IE. I'm using a spry menu in DW with drop-down submenus which don't drop down in IE but do drop down in firefox when tested locally, and don't drop down at all when on the server. This worked when we began, but for some reason has ceased. My coder is losing patience because he's done his bit. I just need him to 'reconnect' the php database with the new files. He can't do anything without the menus working correctly.

So I need urgent help with the spry menu and general advice about css positioning. Thank you all, so much, again.

Here is a link to the site:

http://www.1-2-3-4-5.com

All the best, Joe

greg's picture

He has: 1,581 posts

Joined: Nov 2005

OK, let's do this one step at a time then. First and foremost is this
Fatal error: Call to undefined function showPage() in /var/www/vhosts/1-2-3-4-5.com/httpdocs/index.php on line 80

That means, on line 80 of the file index.php, the script tries to call a function called "showpage", but that function is unknown

This could be due to a few reasons, but the most likely is:

The function "showpage" is set in another file and that other file is included in this one.
Let's say the include file is in a folder called incs/ and called functions.php, so path is incs/functions.php. It might not be anything like this, but this is a common setup
You would have code in index.php such as include_once('incs/functions.php'); (it could be require_once)
Try to find something like that in the index.php

I'm guessing it's not there, as if it was there and tried to include a file that doesn't exist or is in another place, then that would have returned an error. And should return an error BEFORE the error currently being shown as the include needs to be before the actual function is called

Another possibility is you have edited the "functions.php" file and removed the function "showpage". which I would think is less likely than you editing the index.php

Let's get that issue sorted first before we try to fix CSS. So is there anything like that in your index.php?

Perhaps rather than messing yourself, you might want to ask the guy that made the CMS why it cannot find this function, or even just where this function is being set.

Lastly, this main issues of this function not being included is one of two things.
1)It was working fine by the CMS coder, and you edited a file and lost that code required..simply be careful editing what you don't understand

2)It wasn't there from the begginging by the coder, and therefore this is going to be a potentially bad website with potential errors in other places.

They have: 121 posts

Joined: Dec 2008

I'm guessing the php fatal error in the content area of the page isn't helping matters. The document is incomplete, which may be messing with the javascript that is trying to execute. Especially if it is trying to access some DOM elements that don't appear on the page due to the fatal execution error.

May I also add - you really need to consider a different cms 'system'. I am not familiar with the one you are using, but it is poorly done, and incredibly insecure.

If you still want to go the CMS route, which may really be overkill, there seems to be an overwhelming favorite on this site, which is likely a good choice. There are many other good choices as well, most free, and listed on http://www.cmsmatrix.org/.

Cheers,
Shaggy.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

How do you know it's poorly done and insecure if you are not familiar with it?

They have: 121 posts

Joined: Dec 2008

Because I can:
1) get access to the 'backend' without having authenticate
2) I can
a) upload a script that would give me access to most if not all of the system it is running on without authentication
b) obtain system files such as /etc/passwd, etc.

Cheers,
Shaggy.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

Yikes, I see what you mean.

Joe, I would pull that site off-line ASAP, and get a pre-written CMS up there if your programmer can't secure your site properly.

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Banging the Drupal drum again -

I have never had a security problem with Drupal, they release updates every time you turn around, mostly for minor obscure stuff anyway..

I have seen some nasty hacks on Joomla! however...

greg's picture

He has: 1,581 posts

Joined: Nov 2005

Good catch there shaggy! Smiling

And if it truly has bad security (which i don't doubt other people's tests one bit) then I second what people have said regarding getting another CMS altogether.

CMS and other software created by a small company or one man outfit type scenario can be fine if done correctly, but being small it's likely only going to have a few users, and discovering bugs and security issues is often left up to the few people that use the software.
Even large organisations that have thousands of users' input and large development teams (like PHP, Wordpress, PHPBB, Drupal etc) have major security issues and other things in the software not functioning correctly from time to time, but as they have many people using it the major security issues are often found straight away and resolved with an immediately released update.

As for choosing another CMS, there are many out there, but try to use one of the larger, well known ones.
Both Joomla and Drupal sometimes have serious security issues, both often have bug issues, but are updated regularly so this isn't a major issue.
There are pros and cons for Drupal versus Joomla. Drupal overall is a better choice in terms of flexibility and being able to do anything you want with it (pretty much). Whereas Joomla is supposedly easier to use.

The summary is I would opt for Drupal. While the initial learning curve may be a little steeper, you will likely benefit for it in the long run.

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Sure enough, he confirmed that he'd set up a new 'master' css.

It is common for a CMS to have a "default" stylesheet - you just need to override it.

When using multiple css files, the order in which they are read determines the final settings -

In other words, if you use a stylesheet for your design, but the "master" default stylesheet is read afterwards, it will override your settings.

One way to compensate for this is appending your styles to the END of the master stylesheet - better yet, link to your stylesheet after the master one in the CMS template file...

The custom CMS may work on tests but if it doesn't work in real life, what good is it?

A CMS like Drupal or Joomla makes it relatively easy to create drop-down menus that are cross-browser compatible (I generally use the NiceMenus module in Drupal).

They have: 3 posts

Joined: Dec 2008

Thanks for your advice. Can you hint as to where the "master" default stylesheet would be, and how it might be indentified? In the CMS, the styles are called 'Paragraph' and 'Heading 1' etc... but I cannot locate the actual css files that control these. If I could do that, then I could add another style or amend one of the existing ones. These styles are not likely to be in the master CSS that I have created, and which controls the page layout etc, as this was created by me separately from the CMS. Any hints please...?

All the best, Joe

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Hi Joe,

If you install the Web Developer add-on for Firefox, it gives you an "Edit CSS" option that will display the stylesheet files and give you the option to edit them and view the results WYSIWYG (you still need to save them and upload them) - I think the file on the right would be the last one loaded by your template, so that is usually the best place to put custom styles, at the end, so they override previous defs.

Firebug is another indispensible tool/Firefox addon for editing CSS, use Inspect to determine the CSS selector for an object on the page...

Be aware that these tools only help you edit CSS for Firefox display - your styles may display differently in other browsers, particularly IE - (I think there is a developer toolbar for IE, not sure where to get it).

greg's picture

He has: 1,581 posts

Joined: Nov 2005

I just want to mention something on a friendly note...

If you are adding additional stylesheets and don't know what the current ones are, then be careful you don't have two classes or id's of the same name.
Also, be careful editing/adding/modifying PHP/HTML/CSS in a website where you don't know what is already there or what code does what etc. What might seem like a simple little addition or edit may have a catastrophic effect in your site.

It is likely that it will be fine, but you really should have a better idea of what is going on with your sites code before changing it, especially one that has a CMS built in which will have quite a bit of code I imagine.

Again, you are likely to be ok, but just be careful as you could change something important, security or functionality wise.

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

greg wrote:
be careful you don't have two classes or id's of the same name

I presume you mean that the final definition will override earlier ones...

this may actually be desireable

When dealing with complex css in Drupal for example, with often 10 or more stylesheets in play, I typically create a separate stylesheet for my custom styles and load it last, so that I can easily tweak the styles, and reapply the styles when I upgrade components.

greg's picture

He has: 1,581 posts

Joined: Nov 2005

Very true, but taking into account Joe's experience and knowledge, it is very clear that he is nowhere near the stage of overriding CSS with dupe named ID's and Classes.

Besides, in my opinion that's bad coding. I know in "some" circumstances it could be argued to be useful, but it's not best practice and should only be used by experienced coders. It shouldn't be advised to someone who could be soon learning the basics of CSS.

They have: 32 posts

Joined: Dec 2008

How do you know it's poorly done and insecure if you are not familiar with it?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.