Welcome Guest, Not a member yet? Register   Sign In
Path to CSS doesn't work a second time
#11

[eluser]Phil Sturgeon[/eluser]
These are all good points but it can be done almost EXACTLY how you have it now, just use:

Code:
<link rel="stylesheet" href="/system/application/views/default/css/default.css" type="text/css" />

Notice the / at the front. As with others I don't agree with this method, but it is possible for you to sue it that way.

You could take a look at my asset helper (link in my sig). That helps you store things in modules and use full CI paths that are generated dynamically. Id greatly recommend using that helper over any other method as hardcoded ones are a pain in the ass to update!
#12

[eluser]John_Betong[/eluser]
[quote author="Zaatar" date="1194162394"]Oh, I'm sorry John, I didn't notice, apologies.[/quote]

Hi Zaatar,

Off topic!

Referring to your second point about inserting variables inside double quoted strings, this is the reason and also it is easier for me to debug my frequent typos Smile


Single Quotes versus Double Quotes
Quote:// http://www.evolt.org/these-things-i-know-php-tips

Any time you put something in "double" quotes, you are asking PHP to check that content for a variable. So even though the following lines do not contain variables within the double quotes, PHP will still waste precious computing time scanning them anyway.
$mytext = "Dental Plan";
if ($mytext == "Dental Plan") {
echo "Lisa needs braces"; }

Those same three lines of code could be executed much faster if 'single' quotes were used in place of "double" quotes.
$mytext = 'Dental Plan';
if ($mytext == 'Dental Plan') {
echo 'Lisa needs braces'; }

Now that may not seem like much, but having PHP check for variables where it doesn't need to over the course of a larger script, can certainly impede run-time. Just to clarify my point, PHP will not read a variable if it is within 'single' quotes.

Cheers,

John_Betong
 
#13

[eluser]Phil Sturgeon[/eluser]
I knew it! I always thought singles were probably faster but never knew why. Once again my psychic powers do me proud. Big Grin
#14

[eluser]Unknown[/eluser]
I have used
Code:
<link href="<?php echo base_url();?>/default.css" rel="stylesheet" type="text/css">

kept default.css in htdocs\CodeIgniter folder.

and it works
#15

[eluser]Unknown[/eluser]
Code:
<link href="<?php echo base_url().'css/style.css';?>" rel="stylesheet" type="text/css" />




Theme © iAndrew 2016 - Forum software by © MyBB