Welcome Guest, Not a member yet? Register   Sign In
Views URL problem.
#1

[eluser]JackU[/eluser]
My application will do 2 things.

1. Build a website and output it to be displayed in browser.

2. Build a website and output it to a zip (to be unzipped and displayed as a static page).

My Views have this structure (like a template).

Views/Blueish/index.php
Views/Redish/index.php

The actual view file kind of looks like this:
<html>
<head>
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>

Now you probobly see my problem. In case 2 (where i build and zipp it). It works fine (the css stuff is also included in the zip).

But in case 1 when i just load the view and display in the css path is wrong.

So what is the best way to solve this? I really like my directory structure in the Views folder...it is easy maintained and very easy to add new "templates". So i don´t wan´t to change that.

Thanx in advance.
#2

[eluser]Unknown[/eluser]
Try something like this
<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>css/forms.css">
#3

[eluser]weirdo[/eluser]
and make sure put css file/folder same level with application folder....
#4

[eluser]JackU[/eluser]
Thanx for the answers. But i knew i could add some folders or files at the top level. But i don´t want to do that.

Quote:So what is the best way to solve this? I really like my directory structure in the Views folder…it is easy maintained and very easy to add new “templates”. So i don´t wan´t to change that.

There are other people who will make some templates. I really don´t wan´t them to have to add stuff to 2 directories. That´s just bad structure. Isn´t there a better way to do this?
#5

[eluser]Aken[/eluser]
Just change the path to the CSS depending on which output mode is selected. Obviously the two won't use the same path unless you upload to two different places, so you have to take that into consideration.
#6

[eluser]InsiteFX[/eluser]
And the correct use of base_url() is:
Code:
<?php echo base_url('your_path.css'); ?>
#7

[eluser]JackU[/eluser]
Thanx guys for the tips.

I wen´t with the "manipulate link before output" way.




Theme © iAndrew 2016 - Forum software by © MyBB