Welcome Guest, Not a member yet? Register   Sign In
css disappears when adding trailing slash to 4th uri...
#1

[eluser]ramabodhi[/eluser]
Okay I'm using dynamic links to sort the results...
this is what the code works for, and what did work for awhile.... I have no idea why it stopped..

/inventory/view/$username/$sortField/$sortDirection

i can get as far as sortfield ie: inventory/view/someuser/item_age
that will successfully sort by item age..

once i add it to /inventory/view/someuser/item_age/desc
i lose all my css (though the sorting and display work just fine, but my css disappears)..

the results are sorted in my controller by a custom class thusly
Code:
$data['results'] = $this->data->orderBy($results, $sortField, $sortDirection);
$this->load->view('inventory_view', $data);
the orderBy function in the data library is thus
Code:
function orderBy($array, $index, $order)
            {    
                if($order=='asc'){
                    $code = "return strnatcmp(\$a['$index'], \$b['$index']);"; usort($array, create_function('$a,$b', $code)); return $array;
                }elseif($order=='desc'){
                    $code = "return strnatcmp(\$b['$index'], \$a['$index']);"; usort($array, create_function('$a,$b', $code)); return $array;
                }else return $data;
            }
any ideas why my css disappears when i add a fifth uri segment but everything works fine?
#2

[eluser]ramabodhi[/eluser]
update: i'm finding this all over my site, that I can only have a limited number of uri segments or my css disappears. is this supposed to happen?
#3

[eluser]Daniel Moore[/eluser]
Are you using external style sheets and what method are you using to call them if you are? What is your actual code for linking the style sheet?
#4

[eluser]ramabodhi[/eluser]
one external sheet, using dreamweaver template for all views:
Code:
<link href="../www/assets/plain/css/1.css" rel="stylesheet" type="text/css" />
#5

[eluser]Daniel Moore[/eluser]
Ah... You're using a relative path.

I had problems when I tried using a relative path for the CSS once myself in much the same way you are describing.

Assuming the directory you have listed there as "www" is your web root, then might I suggest you change your link reference to:
Code:
<link href="<?php echo base_url();?>/assets/plain/css/1.css" rel="stylesheet" type="text/css" />

See if that helps.
#6

[eluser]ramabodhi[/eluser]
you just made my day Smile
#7

[eluser]JackMeUp[/eluser]
You just made my day too. Plus it's me b-day today!

Dropped in on a google search for a similar problem,
and whammo, problem solved. I noticed the same problem
with image paths too. Switching to absolute paths fixed
that right up as well.

A.
#8

[eluser]TheFuzzy0ne[/eluser]
Happy birthday, and welcome to the CodeIgniter forums! Big Grin
#9

[eluser]Dam1an[/eluser]
The disapearing CSS has caught me out the first time too

All together now
[sing]
Happy birthday to you
Happy birthday to you
Happy birthday dear JackMeUp
Happy birthday to you
[/sing]
#10

[eluser]Daniel Moore[/eluser]
Cool. Glad I could make so many people's day. Just hope I don't make Clint Eastwood's day. Wink

And Happy Birthday, JackMeUp. Welcome.

@Dam1an: You were a little flat when you hit that G. Wink




Theme © iAndrew 2016 - Forum software by © MyBB