Welcome Guest, Not a member yet? Register   Sign In
CSS not loaded
#1

[eluser]pabloc[/eluser]
hi everyone.
I need some help, couse coudn´t found in web sites.
I have this web structure:

CI
- application
-controllers
* auth.php
- view
* footer.php
* header.php
- app
- ion_auth
- website
* register.php
- css
- font
- img
- js
-system

The register.php has something like this:

<?php echo form_open("auth/create_user");
echo form_input('first_name','',$value_input);
echo form_password('password','',$value_input);?>
<button type="submit" class="btn btn-primary">Register<i class="icon-white icon-arrow-right"></i></button>
&lt;?php echo form_close();?&gt;

The auth/create_user end of function is just like this:

this->_render_page('auth/create_user', $this->data);

But I changed this line with the next ones:

$this->load->view('header');
$this->load->view('web/register',$this->data);
$this->load->view('footer');

Web page load is ok, bu CSS /JS in header/footer isn't loading!, here's the problem.
hope somebody can help!
thanks!
Pablo
#2

[eluser]PravinS[/eluser]
can you please check css and js file path in view source and let us know
#3

[eluser]anis2505[/eluser]
How do you include the css/js files. are you hardcoding their paths or are you using built-in function such site_url and base_url to do the job.
#4

[eluser]pabloc[/eluser]
Hi everyone!
CSS´s are included in the header.php just like this:

<!DOCTYPE html>
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" c initial-scale=1.0"&gt;
&lt;meta name="description" c&gt;
&lt;meta name="author" c &gt;
&lt;title&gt;MySite&lt;/title&gt;
&lt;link href="&lt;?php base_url()?&gt;css/bootstrap.min.css" rel="stylesheet"&gt;
&lt;link href="&lt;?php base_url()?&gt;css/bootstrap-responsive.min.css" rel="stylesheet"&gt;
&lt;link href="&lt;?php base_url()?&gt;css/font-awesome.css" rel="stylesheet"&gt;
&lt;link href="&lt;?php base_url()?&gt;css/font-awesome-ie7.css" rel="stylesheet"&gt;
&lt;link href="&lt;?php base_url()?&gt;css/boot-business.css" rel="stylesheet"&gt;
&lt;/head&gt;

that's what you are asking?
Regards!
Pablo
#5

[eluser]anis2505[/eluser]
[quote author="pabloc" date="1371212728"]Hi everyone!
CSS´s are included in the header.php just like this:

<!DOCTYPE html>
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" c initial-scale=1.0"&gt;
&lt;meta name="description" c&gt;
&lt;meta name="author" c &gt;
&lt;title&gt;MySite&lt;/title&gt;
&lt;link href="&lt;?php base_url()?&gt;css/bootstrap.min.css" rel="stylesheet"&gt;
&lt;link href="&lt;?php base_url()?&gt;css/bootstrap-responsive.min.css" rel="stylesheet"&gt;
&lt;link href="&lt;?php base_url()?&gt;css/font-awesome.css" rel="stylesheet"&gt;
&lt;link href="&lt;?php base_url()?&gt;css/font-awesome-ie7.css" rel="stylesheet"&gt;
&lt;link href="&lt;?php base_url()?&gt;css/boot-business.css" rel="stylesheet"&gt;
&lt;/head&gt;

that's what you are asking?
Regards!
Pablo[/quote]

Ok just make sure that on the config file base_url starts by "http://"
#6

[eluser]pabloc[/eluser]
Yes,

base_url() = http://127.0.0.1/mywebsite/

Pablo
#7

[eluser]anis2505[/eluser]
[quote author="pabloc" date="1371218229"]Yes,

base_url() = http://127.0.0.1/mywebsite/

Pablo[/quote]


Ok one extra thing if you are using apache remove the .htaccess file if you are using one and try again. sometimes apache behave stragely
#8

[eluser]pabloc[/eluser]
mmmmmmmmmmmmm......

I think... you got it !!! I removed .htaccess (use it because i eliminate index.php from url).

And... and... all website behavior is the same when CSS/JS problems occurs!

I don´t know if its usefull but, here's the .htaccess code:

RewriteEngine on
RewriteCond $1 !^(index.php|css|font|img|js|public|robots.txt)
RewriteRule ^(.*)$ /mycodeigniterwebsite/index.php/$1 [L]

Pablo

#9

[eluser]anis2505[/eluser]
[quote author="pabloc" date="1371219750"]mmmmmmmmmmmmm......

I think... you got it !!! I removed .htaccess (use it because i eliminate index.php from url).

And... and... all website behavior is the same when CSS/JS problems occurs!

I don´t know if its usefull but, here's the .htaccess code:

RewriteEngine on
RewriteCond $1 !^(index.php|css|font|img|js|public|robots.txt)
RewriteRule ^(.*)$ /mycodeigniterwebsite/index.php/$1 [L]

Pablo

[/quote]

It's not working for me. I guess you have to dig further to get the best configuration.

One advise work build your application and at the end think about cleaning the urls

regards
#10

[eluser]pabloc[/eluser]
Ok anis2505
All your answers were very helpfull!
Best regards!




Theme © iAndrew 2016 - Forum software by © MyBB