Jump to content

[SOLVED] PHP and CSS


Darkfly

Recommended Posts

Hey all,

 

I'm having some problems with PHP. I've been googling for while now looking for some answers, but can't quite fine what I'm looking for.

 

Here's whats up. I have a PHP file, that is as follows:

// sets the default color for the user text 

$def_fontColor = "#000000";  //<--- Sets colour black, hard coded. Want to try and have this load from the CSS file instead.

 

This is a config file, which loads other php files. What I'm trying to do is I'm setting up web themes with the CSS file, and its workign great. I have the other pages loading the difference themes when a user picks it, but the default font colour is black on all of them cause the config file for the PHP as above is hard coded it. What I would like to do is instead of it hard coded in, have it call the CSS file, and use the colours in there.

 

Example CSS:


// sets the default color for the user text 
.def_fontColor {
color: #EDF1FA;
}

 

Does anyone know how I can do that?

Link to comment
Share on other sites

Not quite sure if this is what you are after, but in the <head> section of your page you will need a link to the css file.

 

<head>
    <link href="style.css" rel="stylesheet" type="text/css" />
</head>

 

Then on your pages you will call that depending on whether you set it to an "id" or a "class".

Link to comment
Share on other sites

Okay, that didn't work out quite so well, but anyways I found where the background colour was being called from in the config.php

 

Over here in this file template.main.php

	
<?php
include("config.php");

<div id="message_border" name="message_border" class="message_border" style="right:<?php echo $style_right;?>px;bottom: <?php echo $style_bottom;?>px;position:fixed;background: url('backgrounds/<?php echo $_SESSION['room_image'];?>') center center no-repeat;background-color: <?php echo $background_color;?>;"/>

	<div id="div_chat" class="message_display" style="z-index:99;bottom: <?php echo $style_bottom;?>px;">

		<font class="username"><?php echo html_entity_decode($_SESSION['room_desc']);?></font>

	</div>

</div>
?>

Where it's saiys background-color: <?php echo $background_color;?> you can see thats where if gets the colour from the config.php

 

So I present a new problem. I want to have that defined in the CSS file now, not in the config.php. How would I go about this?

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.