Welcome Guest, Not a member yet? Register   Sign In
How to create a default css file for CI?
#11

[eluser]Shaheer[/eluser]
result HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;link rel="stylesheet" href="http://localhost/style.css" /&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Web Test Site&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
<h1>Welcome to this site</h1>
<p class="test"> Hello, shaheer, now we're getting dynamic! </p>
http://localhost/&lt;/body&gt;
&lt;/html&gt;
#12

[eluser]tomcode[/eluser]
In Your browser, You can view the page 's source code, there You can see the resulting HTML code
#13

[eluser]tomcode[/eluser]
I guess You better work through the user guide
#14

[eluser]Slowcheetah[/eluser]
When you visit http://localhost/style.css in your browser, does it give you the css file?
#15

[eluser]Shaheer[/eluser]
no it says file dont exist Sad
#16

[eluser]Slowcheetah[/eluser]
Then the file is not at the correct location.. I suggest you to check your paths in the config file.
#17

[eluser]Shaheer[/eluser]
what should i check in the config file. i mean i left it with default settings. and where the file should be? i have put it in application folder, views, and htdocs. I am using Xampp on Windows...
#18

[eluser]Slowcheetah[/eluser]
There are really only few things to check

1) check where you codeigniter is installed
2) configure the config file according to this
3) be sure the css is on the correct location (could be on any location, just point it right in your HTML)

want 100% CI; you can use the link_tag() from the HTML helper to load you CSS files

But honestly if you can't even solve a simple problem like this it looks like you're missing loads of basic knowledge.
#19

[eluser]Shaheer[/eluser]
solved!!!

actually the problem was; i am using MVC first time so i was confused about where should i put the css, since all the requests were handled by index.php so i thought that that should be the correct place to put it. but it didn't worked the problem actually was with ..htaccess which comes with CI. It was forwarding all the requests to index.php as a parameter so my css file was actually passed to index.php as a param and it tried to load that controller (style.css) but since such a controller wasn't present it should me Page not found error i modified the .htaccess file and now it is working properly thanks for your help.

Big Grin

i had another question if any one can help me. How can i create a default view in CI? is there a way?
#20

[eluser]Slowcheetah[/eluser]
Defining a Default Controller




Theme © iAndrew 2016 - Forum software by © MyBB