Welcome Guest, Not a member yet? Register   Sign In
Wierd problem
#1

[eluser]juan1904[/eluser]
Hi again people,

I got a pretty wierd problem.

In schedule.php (controller) I got this function:

Code:
function index($round = 1)
    {
        $this->load->model('schedule_model');

        // If the round is not between 1 and 58, show an error.
        if($round < 0 OR $round > 58)
        {
            show_404();
        }

        $data['rounds'] = $this->schedule_model->get_rounds();
        $data['schedule'] = $this->schedule_model->get_schedule($round);
        $data['header'] = 'Hela spelschemat';

        $data['content'] = 'schedule/schedule';

        $this->load->vars($data);
    }

When I write the URL for this I get the correct webpage (with CSS and everything), but I also got another function get_played($round) in the same class which right now got the exact same code is index($round) but when I write the URL for that one all the CSS is gone. The page is just white, no background, times new roman text and blue links.

I don't get any other error messages. Any suggestions? :S
#2

[eluser]Dam1an[/eluser]
Add &lt;?=base_url()?&gt; to your CSS paths in the view

The reason it works in index but not the others, is you add an extra segment to the URI so it thinks its in a differant relative directory
#3

[eluser]Evil Wizard[/eluser]
I would suggest using firefox with firebug plugin installed to inspect the source code of the generated page to see exactly what the link to the CSS file returns. That could give a little more information as to why the CSS file is not being found.

I assume the url that works is "http://somedomain.com/schedule/" and the one(s) that don't are like "http://somedomain.com/schedule/get_played/1" (or any other number at the end)

Which does suggest that there could be an issue with .htaccess or your routes.

Hope this points you in the right direction
#4

[eluser]juan1904[/eluser]
Dam1an:

Aha thank you. Well then I need to put that on all my pictures aswell.

Evil Wizard:
Dam1an solved my problem but I'll install firebug anyway for future use. Thanks!
#5

[eluser]Dam1an[/eluser]
You can use the HTML helper for stuff like images Smile

(And I also recommend Firebug... its awesome)
#6

[eluser]Evil Wizard[/eluser]
yeah, sorry i was writing the reply at the same time as Dam1an and assumed you used the &lt;?=base_url()?&gt; or just forced the URI in the link tag with the "/" at the beginning indicating the URL is not relative to the current URL but take from the web root




Theme © iAndrew 2016 - Forum software by © MyBB