Jump to content

Set style.css in config.php - not pulling through css


WAMFT1

Recommended Posts

I am trying to identify the style.css through the config file then bring into the project using the include command. I can get the project to tell me which css style is listed but it is not actually linking the css.  Is this possible or am i wasting my time. I want to do it this way so that I can change the style.css if required and it pick up the new details without the need to clear cache to implement changes. 

####### CONFIG.PHP

<?php
//EXTRA PARAMETERS
$sitename = "DEMO SITE";
$timezone = "Australia/Brisbane"; //Set for head office location
$stylecss = "../include/style.css";
$loginurl = ""; // default landing page for login
$logoimg = "";
$logoimg_params = "height='50px', width='100px'";
?>

####### INDEX.PHP

<?php
session_start();
include('include/config.php'); 
include('include/edb.php');
?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $sitename?></title>
<link href="<?php echo $stylecss?>" rel="stylesheet" type="text/css" />
</head>

 

Link to comment
Share on other sites

The way you describe this makes it sound like you're doing something more complicated than what it should be...
With a proper server, you can use a normal <link> to your CSS file and never need to clear a cache - if you do then that means it's not configured properly.

The question to answer first is whether your browser is receiving the correct <link>, and if so why it isn't loading the CSS. My guess would be the file path, as you need to remember that $stylecss is relative to the webpage URL and not to the config.php file path.

Link to comment
Share on other sites

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.