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

[eluser]veamon[/eluser]
I'm transitioning an existing site into Code Igniter, and I've hit a snag.

In my original, I have my site laid out as such (for example):

<root of site>
<css>
<images>
index.html
</root

and in my index.html, would be something like
<img src="./images/myimage.jpg">

How do I do this in code igniter? I have a view controller setup, with an images subdirectory in the views folder, and try and add it the same way but it doesnt show.
#2

[eluser]pistolPete[/eluser]
Leave the css and image files in the web root.
Then link them using absolute paths:
Code:
<img src="/images/some_pic.png" />
#3

[eluser]veamon[/eluser]
ah. so if i'm using a wysiwyg, I'm going to have to have 2 copies, one in the application folder to design, and then one in the root to actaully see them?
#4

[eluser]pistolPete[/eluser]
[quote author="veamon" date="1236397436"]so if i’m using a wysiwyg[/quote]
What are you doing?
Are you using an editor like TinyMCE to edit the contents?
Why should you need two copies?
#5

[eluser]veamon[/eluser]
Well, I'm using dreamweaver, and with the views being buried in application/system/whatever/whatever, and the main index.php being at the web root....thats why. I'm not going to have ....../images in my controller while I'm designing.

*EDIT*

Nevermind. I found I can just have my view in the root dir, and have my controller access it by /controllername.
#6

[eluser]veamon[/eluser]
Never mind, this doesnt work.

Anyone have any ideas? Am I going to have to echo full paths in my views folder to my images one that is in the root directory?

I tried moving a view outside and putting it in the root, and then having my controller load base_url().view, but I get a "page cannot be loaded".
#7

[eluser]pistolPete[/eluser]
Does this work for you?

directory structure
Code:
webroot
    -> index.php

    -> images/
        -> some_image.png

    -> css/
        -> some_style.css

    -> system
        -> application
            -> views/
                -> some_view.php

            -> controllers/
                -> some_controller.php

some_controller.php
Code:
&lt;?php
class Some_controller extends Controller {
    function index()
    {
        $this->load->view('some_view');
    }
}

some_view.php
Code:
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;some title&lt;/title&gt;
        &lt;link rel="stylesheet" href="/css/some_style.cs" type="text/css" /&gt;
    &lt;/head&gt;
    &lt;body&gt;
        <img src="/images/some_image.png" />
    &lt;/body&gt;
&lt;/html&gt;




Theme © iAndrew 2016 - Forum software by © MyBB