0
Welcome Guest! Login
0 items Join Now

Regarding validation and multiple CSS files

    • Dan L's Avatar
    • Dan L
    • Elite Rocketeer
    • Posts: 1453
    • Thanks: 0

    Regarding validation and multiple CSS files

    Posted 17 years 6 months ago
    • I've almost finished making a custom template but it fails validation because the index.php makes a call to separate .php files (for different template layouts) which in turn make calls to separate .css files.

      Basically the code calls one of the .php files (depending on which page the user is on), the testing code is within the <body> section.

      The code which is then called calls up its corresponding .css file; but of course, because the code is called from the <body> and references CSS files, it fails the XHTML validation. The pages work absolutely fine in IE6/7 & FF.

      What is the method to get around this issue?
    • Last Edit: 17 years 5 months ago by Dan L.
    • Toolbox Digital | Dribbble | Forrst
  • Re: Regarding validation and multiple CSS files

    Posted 17 years 6 months ago
    • Hello Dan,

      If I got your question well, do you mean that in the separated php file there is a line like:
      <link href="css_files.css" rel="stylesheet" type="text/css" /> ?

      If so, you can cut that line from the separated php file, then paste it in the index.php of your template between <head> and </head>. I always do it, however I believe maybe there is another way better than this. Just my little suggestion. ;)

      Best Regards,

      Arifin FinLy
    • Dan L's Avatar
    • Dan L
    • Elite Rocketeer
    • Posts: 1453
    • Thanks: 0

    Re: Regarding validation and multiple CSS files

    Posted 17 years 6 months ago
    • Hi Arifin,

      Yes that is correct - however, each .php page requires its own .css.

      So:

      index.php tests to see if user is on the frontpage
      if yes: load mainpage.php
      if no: load articlepage.php

      mainpage.php requires mainpage.css for layout
      articlepage.php requires articlepage.css for layout

      The template_css.css file is used for common styling elements and in loaded in index.php.

      So you see, I can't just load all three stylesheets in the <head>, as articlepage.css and mainpage.css contain style classes that use the same name, and they'd just conflict with one another.

      I basically need to do this:

      When mainpage.php is loaded, use template_css + mainpage.css for styling
      When articlepage.php is loaded, use template_css + atriclepage.css for styling

      Like I said, it works perfectly fine but its the validation failure thats the problem.

      TIA

      Dan
    • Toolbox Digital | Dribbble | Forrst
  • Re: Regarding validation and multiple CSS files

    Posted 17 years 6 months ago
    • Hello Dan,

      Could you please show me the link which not valid XHTML ?

      Best Regards,

      Arifin FinLy
  • Re: Regarding validation and multiple CSS files

    Posted 17 years 6 months ago
    • Hello Dan,

      Maybe you can try this :
      <?php //If you are in frontpage ?>
      <?php if (mosGetParam( $_REQUEST, 'Itemid')&nbsp; == "1") { ?>
           <link href="Link to your - mainpage.css" rel="stylesheet" type="text/css" /> 
      <?php //If you are NOT in frontpage ?>
      <?php } else { ?>
           <link href="Link to your - articlepage.css" rel="stylesheet" type="text/css" /> 
      <?php }&nbsp; ?>



      Put that code before </head>

      Hope it can help you. Please correct me if I am wrong because I am not a good coder.


      Best Regards,

      Arifin FinLy
    • Last Edit: 17 years 6 months ago by Arifin FinLy.
    • Dan L's Avatar
    • Dan L
    • Elite Rocketeer
    • Posts: 1453
    • Thanks: 0

    Re: Regarding validation and multiple CSS files

    Posted 17 years 5 months ago
    • Dan L's Avatar
    • Dan L
    • Elite Rocketeer
    • Posts: 1453
    • Thanks: 0

    Re: Regarding validation and multiple CSS files

    Posted 17 years 5 months ago
    • GollumX's Avatar
    • GollumX
    • Elite Rocketeer
    • Posts: 2817
    • Thanks: 0

    Re: Regarding validation and multiple CSS files

    Posted 17 years 5 months ago
    • whats the deal with validation anyway. you say it works fine in iexplorer and ff, what advantages does validation provide?? does it help SEO?

      someone please tell me what i'm missing
    • Say no to Internet Explorer 6.
      twitter.com/mark_up
    • Dan L's Avatar
    • Dan L
    • Elite Rocketeer
    • Posts: 1453
    • Thanks: 0

    Re: Regarding validation and multiple CSS files

    Posted 17 years 5 months ago
    • To be honest, it's not something I normally worry about too much, however in this case the job is for a client and I'd already specified that the template/site would be XHTML & CSS validated.

      It also bugged me that it was fine apart from this one error - if I'd had like 50 errors (which is normally what I get, lol) then I probably would not have bothered, but it seemed worth finding out if this could be fixed.

      When dealing with cross-browser compat I believe its also worth making an effort just to ensure your template works as well as possible on all browsers (well, as much as you can anyway).
    • Toolbox Digital | Dribbble | Forrst

Time to create page: 0.053 seconds