PHP CSS Propagation Problem...

Discussion in 'PHP' started by Mr.Dog, Apr 5, 2013.

  1. #1
    Hi,

    I am using PHP echo to display the content of an external file on a host page (both .php).

    The problem is that the CSS settings aren't propagating and I'm getting the plain blank typical HTML colors and fonts...

    My host page is a .php page (it could be index.php or any other page) containing this (stands alone, I am using no DIVs):
    <?php include("newsbox1.php"); ?>
    Code (markup):
    My source page ("newsbox1.php") contains this code with echo:
     <?php echo
    '<div class="newsbox"
    <p>
    <a class="link" href="weather.htm">Wealther</a>
    <br/>
    Isn\'t it a great day today? So sunny and warm...
    <br/>
    </p>
    </div>';
    ?> 
    Code (markup):
    So, basically my newsbox1.php is pulling CSS settings from an external CSS file, which sets the colors, the font type etc for the DIV, the links etc.

    The code I am using to pull the CSS settings is:
    <link type="text/css" rel="stylesheet" href="design.css" media="screen,projection,tv">
    Code (markup):
    Not sure if this is supposed to work. I see my CSS itself looks OK...

    By the way: the link type is the only one that's propagating. I am not getting the DIV settings at all.

    What could cause the non-propagation problem?

    :)
     
    Last edited: Apr 5, 2013
    Mr.Dog, Apr 5, 2013 IP
  2. YoGem

    YoGem Active Member

    Messages:
    676
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    90
    #2
    Without having a look at the CSS and HTML it's going to be a bit hard to tell you why :p

    Post them and I'll try to figure what's wrong with it!
     
    YoGem, Apr 5, 2013 IP
  3. Mr.Dog

    Mr.Dog Active Member

    Messages:
    912
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Obviously the typical HTML way of loading the CSS is not working on the PHP page.

    Basically: I need to know how to apply CSS settings to a DIV class on a .PHP page...

    Of course, this source .PHP page with the CSS-ed DIV is INCLUDED on a host .PHP page. Host is using a CSS stylesheet and it's working. But I couldn't get the source .PHP to load the CSS...
     
    Mr.Dog, Apr 7, 2013 IP
  4. YoGem

    YoGem Active Member

    Messages:
    676
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    90
    #4
    Look, from the example you sent me the file you are loading is just printing basic html that need to be styled. To style it you need to use the CSS that you already load in the main html file.

    Then from the example you show me I see you include a PHP file in a right sidebar and that the PHP file print a new set of <html></html> like if it is a different page, plus you reload the same CSS style.

    When you include a PHP file to print some HTML there is no need to treat it as a different HTML page unless you use an iFrame but that's not your case. All you need is to check well your HTML code, remember I told you that your PHP file doesn't close well a DIV tag ( <div class="classhere <p>Text</p></div>), to remove the extra headings and meta-tags from the produced html code and that should work.
     
    YoGem, Apr 7, 2013 IP
  5. Mr.Dog

    Mr.Dog Active Member

    Messages:
    912
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    60
    #5
    I managed to make it work, mate... Eventually I used inline CSS...

    I appreciate your help. Will post more updates, I'm having some issues with this PHP code...
     
    Mr.Dog, Apr 7, 2013 IP