Welcome Guest, Not a member yet? Register   Sign In
Help! all styles disappear when I go to a different view
#1

[eluser]zuluanshee[/eluser]
here is the site:
travelfound.com

press the 'Europe' link at the right (that's teh only one currently configured), you'll see what happens.

the view is mostly the same as the front page.

here si the code

view
Code:
<div class="newsItem">
<h1>Where Do You Want To Go?</h1>
<ul>
<li>&lt;?php echo anchor('continents/','Africa');?&gt;</li>
<li>&lt;?php echo anchor('continents/', 'Asia');?&gt;</li>
<li>&lt;?php echo anchor('continents/index/Europe/', 'Europe');?&gt;</li>
<li>&lt;?php echo anchor('continents/', 'US and Canada');?&gt;</li>
<li>&lt;?php echo anchor('continents/', 'Central America and Caribbean');?&gt;</li>
<li>&lt;?php echo anchor('continents/','South America');?&gt;</li>
<li>&lt;?php echo anchor('continents/','Pacific Rim and Oceania (+Australia & New Zealand)');?&gt;</li>
</ul>
                
</div>
model
Code:
class CountriesModel extends Model
{
    function getCountries($continent)
    {
        $query = $this->db->query("SELECT country_name FROM countries WHERE continent_name = '$continent'");
        //$query = $this->db->where('country_name', $continent);
        
        if($query->num_rows() > 0)
        {    
            foreach($query->result() as $row)
            {
                $data[] = $row;
            }
        }    
        return $data;
    }
}

controller
Code:
class Continents extends Controller
{
    function Continents()
    {
        parent::Controller();
//        $this->load->helper('url');
    }
    
    function index()
    {
        $this->load->model('countriesmodel');
        $continent = $this->uri->segment(3);
        echo "xxx" . $continent;
        $data['countries'] = $this->countriesmodel->getCountries($continent);
        $this->load->view('continentview', $data);
    }    
}
#2

[eluser]davidbehler[/eluser]
I take it that your css folder is outside the system/application folder? Then try using
Code:
&lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url().'/css/style.css'; ?&gt;" /&gt;
instead of your relative path.
#3

[eluser]Dam1an[/eluser]
[quote author="waldmeister" date="1251113211"]I take it that your css folder is outside the system/application folder? Then try using
Code:
&lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url().'/css/style.css'; ?&gt;" /&gt;
instead of your relative path.[/quote]Actually, base_url includes the '/' at the end, so you'd change it to
Code:
&lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url().'css/style.css'; ?&gt;" /&gt;
#4

[eluser]davidbehler[/eluser]
You are right!
For my projects I have rewritten the base_url method to actually take a parameter (similar to site_url) and not have to do the concatination myself Smile
#5

[eluser]zuluanshee[/eluser]
ok i guess it's normal to put in system/applicatin folder. Changing right now
#6

[eluser]zuluanshee[/eluser]
hmm, same problem. Front page is ok but when you click Europe, the styles are still missing.
#7

[eluser]InsiteFX[/eluser]
Try this:

Code:
In head section:

&lt;?php
    echo "\n". link_tag('assets/css/your.css');
?&gt;

This should be in all your html views.

Enjoy
InsiteFX
#8

[eluser]zuluanshee[/eluser]
Bravo! Fixed! Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB