Welcome Guest, Not a member yet? Register   Sign In
Linking to Stylesheets
#13

[eluser]daniel9201[/eluser]
try this
in your config.php

$config['css_url'] = "http://".$_SERVER['HTTP_HOST'];
$config['css_url'] .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/css/';

specify the location of the css directory relative to the application root

in your view

<head>
<title>Sample Page</title>

<link rel="stylesheet" type="text/css" href="<?php echo $this->config->item('css_url') . 'mystyles.css'; ?>" media="screen" />



</head>

another handy trick is to use

$config['base_url'] = "http://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/index.php/';

in the config.php so you can rename your root application folder to whatever you want and just rename or move the whole folder and you application will pick up the new location.

it does mean if your using forms you have to use something like

<?php
$my_base = base_url();
//$my_action = $my_base . "site/processlistedit";
$my_action = $my_base . "site/messages/edit/" . $id;
echo "<form method='post' action= $my_action />";
?>

// End of table
<tr><td>&lt;input type="submit" value="Submit" /&gt;&lt;/td></tr>
</table>
&lt;/form&gt;

&lt;?php
$my_base = base_url();
$my_action = $my_base . 'site/' . $myaction1;
echo "<br/>";
echo "<br/>";
echo "<a href=" . $my_action . " title='Home'>Click Here to return</a>";
?&gt;

it works for me but if you have a better way let us know.


Messages In This Thread
Linking to Stylesheets - by El Forum - 09-18-2010, 06:41 AM
Linking to Stylesheets - by El Forum - 09-18-2010, 09:39 AM
Linking to Stylesheets - by El Forum - 09-18-2010, 09:43 AM
Linking to Stylesheets - by El Forum - 09-18-2010, 10:05 AM
Linking to Stylesheets - by El Forum - 09-18-2010, 11:05 AM
Linking to Stylesheets - by El Forum - 09-18-2010, 11:16 AM
Linking to Stylesheets - by El Forum - 09-18-2010, 03:13 PM
Linking to Stylesheets - by El Forum - 09-18-2010, 03:16 PM
Linking to Stylesheets - by El Forum - 09-18-2010, 06:41 PM
Linking to Stylesheets - by El Forum - 09-18-2010, 06:43 PM
Linking to Stylesheets - by El Forum - 09-18-2010, 10:48 PM
Linking to Stylesheets - by El Forum - 09-19-2010, 12:36 AM
Linking to Stylesheets - by El Forum - 09-20-2010, 12:30 PM
Linking to Stylesheets - by El Forum - 09-20-2010, 01:56 PM
Linking to Stylesheets - by El Forum - 09-22-2010, 11:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB