WAMFT1 Posted October 23, 2023 Share Posted October 23, 2023 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> Quote Link to comment https://forums.phpfreaks.com/topic/317390-set-stylecss-in-configphp-not-pulling-through-css/ Share on other sites More sharing options...
requinix Posted October 23, 2023 Share Posted October 23, 2023 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. Quote Link to comment https://forums.phpfreaks.com/topic/317390-set-stylecss-in-configphp-not-pulling-through-css/#findComment-1612519 Share on other sites More sharing options...
ginerjm Posted October 23, 2023 Share Posted October 23, 2023 Yes - I'd be curious what your html actually looks like in your browser. How about cutting and pasting it into a post here. Just the part we're talking about not the whole page. Quote Link to comment https://forums.phpfreaks.com/topic/317390-set-stylecss-in-configphp-not-pulling-through-css/#findComment-1612520 Share on other sites More sharing options...
Barand Posted October 23, 2023 Share Posted October 23, 2023 Do you mean something like the last 7 lines of the initial post? Quote Link to comment https://forums.phpfreaks.com/topic/317390-set-stylecss-in-configphp-not-pulling-through-css/#findComment-1612521 Share on other sites More sharing options...
ginerjm Posted October 23, 2023 Share Posted October 23, 2023 Which contains some php code that I'd like know what it looks like.... Quote Link to comment https://forums.phpfreaks.com/topic/317390-set-stylecss-in-configphp-not-pulling-through-css/#findComment-1612524 Share on other sites More sharing options...
maxxd Posted October 24, 2023 Share Posted October 24, 2023 OP - check the developer's tools in your browser. I'll bet requinix is right that the file path is off and the css file is not being found - if that's the case the network tab should show a 404 for your CSS file. Quote Link to comment https://forums.phpfreaks.com/topic/317390-set-stylecss-in-configphp-not-pulling-through-css/#findComment-1612533 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.