Jump to content

page1 adopts css of page2 when being included via php


meltingpoint

Recommended Posts

as you might have guessed and if not read in the forum guidelines. It would be great if you could show some code and make more precise what your problem is. Unless of-course you want me to repeat exactly what I said before.

If you have an online example of it it would be even better so we can check it out.

Link to comment
Share on other sites

index.php : is a page made with a WYSIWYG program, has the text -Berkshire Systems LLC, has an html box which is a division named "background" and the pages color is white as set in the page properties

 

page1.php: is a page made with a WYSIWYG program, has the text -This is the included page, has <link rel="stylesheet" type="text/css" href="test_style.css"/> placed between the head tags and its default color is white as set in the page properties.

 

test_style.css has the following

body {background-color: grey;}

 

when viewing page1.php (www.taskforcecentral.com/dev2/page1.php) you get the page which displays the proper text as described above and the back ground is grey.

 

when viewing index.php (www.taskforcecentral.com/dev2/index.php) all of the page(s) are grey instead of the only the div "background" being grey and the rest of the index being white.  So the index.php includes the page1.php and inherits the grey background as defined in the test_style.css.

 

So that is where I am at.  The created div of "background" which contains the included page1.php changes the whole page instead of just the background of the div- background.

Link to comment
Share on other sites

Why not contain everything within a div named eg. #container and give it a background color.  Use this on page one. Eg. Div id = container....  And on page 2 #container2.        div id = container2

This way you will only have one css and nothing will get muddled up as the two areas in question will have different names.

Link to comment
Share on other sites

Did not work.  Still inherited the color of the included page.

 

 

Frustrating....................

 

Don't use a wysiwyg editor... period!

 

Also I just checked https://www.taskforcecentral.com/dev2/index.php

and i don't see any grey stuff you talked about or more important what is page 1 or 2.

 

Besides that you omitted to close you <body> tag  (<body )

 

A simple setup could look like this:

 

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
    <head><meta charset="UTF-8" />
        <link type="text/css" rel="stylesheet" href="css/style.css" />
        <link rel="icon" type="image/x-icon" href="favicon.ico"/>
        <title>example</title>
    </head>
    <body>
        <div id="wrapper">
            <div id="page1">

            </div>
            <div id="page2">

            </div>
        </div>       
    </body>
</html>

 

than by using #page1  or #page2  you can target the inner elements and set a style to them.

Link to comment
Share on other sites

cssfreakie-

 

It is indeed the WYSIWYG editor that is causing the problem for when I build a standard php page setting the div1 and div2 and including a page with in that- it all works fine.  So I will have to experiment to see if I can override the WYSIWYG editor.

 

Meanwhile- I will work on your example. 

 

Thanks very much for the help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.