CodeIgniter Forums
Only absolute links? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Only absolute links? (/showthread.php?tid=10511)

Pages: 1 2


Only absolute links? - El Forum - 08-11-2008

[eluser]Tom Glover[/eluser]
I use Site url for calls to controllers and functions, but i use base url to call folders and image/js files.


Only absolute links? - El Forum - 08-12-2008

[eluser]Tommy_DK[/eluser]
When I try to find the css file through the url the only thing that works is:
http://localhost.example.dk/system/application/views/layout/style.css

Is there a nicer/shorter way to access the file?


Only absolute links? - El Forum - 08-12-2008

[eluser]Unknown[/eluser]
I have also problems with including files.

Example I want include some file from controllers dir to some file in views dir.

When I write;

include '../controllers/prices_i.php';

It doesnt work. (prices_i.php is my file in controllers dir).

When I try to reach that file with absolute path I get the same thing - nothing.

Some suggestions?


Only absolute links? - El Forum - 08-12-2008

[eluser]Gavin Blair[/eluser]
@Tommy_DK:

Keep .js and image files outside of the system folder. The top level will look something like this:

/my_site
/system
/images
/style
/user_guide
index.php

This will make including javascript and images easier.

@grudman:

I'm not sure why you are including a controller in a view, it seems to break MVC methodology. It would be easier to include an external file if it was in the views folder.

include 'prices_i.php';

would include /views/prices_i.php


Only absolute links? - El Forum - 08-12-2008

[eluser]Tommy_DK[/eluser]
@Gavin Blair

Thank you very much for the tip. What do you use the /my_site folder to?


Only absolute links? - El Forum - 08-12-2008

[eluser]Gavin Blair[/eluser]
@Tommy_DK:

When I was editing it, there was spacing... /my_site was the parent folder