Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP/CSS Style switcher issues & more Reply To: PHP/CSS Style switcher issues & more

#240568
I.m.learning
Participant

Well good, at least I know I’m in the right place…thank you for your replies.

So let’s start with this; considering It’s under PHP. I am using 13 different CSS sheets to allow users the option to change the page “border”. what this means is using a color image to change the HTML tag. This is additional to the body tag (that is another option for the user).

Each of the css styles contain around 300 lines of the same code. The difference is the URL for the different color, which is only a few lines.

I used include for the HTML for the header, footer, etc. I have researched this issue for a few days and see so many sources stating NOT to use @import.

I would like to reduce the reused code (as if we used include) for these CSS sheets. So, what I am looking for is this:

is there code to use the same CSS for these codes into one “include” (or equivalent)?

or, is there a code that could simplify my present code (is there a code I am not using to better reflect the color change options).

My schooling never taught us programming, they only gave us the codes and never expanded on its use. This leaves me lost.
Again, it’s best if someone visits my page and notices I am not using the best practice.

Notice that my code (using Developer Tools [F12]) looks awry; however, that is the include putting the code as stated.

My index.php code is:

<!– http://localhost/honestlee/index.php –>
<?php include(“include/mainhead.html”); ?>
<?php include(“include/banner.html”); ?>
<?php include(“include/navigation.html”); ?>
<?php include(“content/home.html”); ?>
<?php include(“include/preferences.html”); ?>
<?php include(“include/footer.html”); ?>

The top line code allows me to open the page in wampserver without having to type it in (I do this with all my PHP codes)

I am going to post my other issue in a different thread in order to keep things more relevant.