Welcome Guest, Not a member yet? Register   Sign In
CSS Files and YUI
#1

[eluser]Carlton[/eluser]
Possibly the most basic question that will get asked on these forums but whereabouts should we (by convention) store our stylesheets? I have seen a lot of tutorials with views containing inline style...which is something I really hate doing.

Also, does anyone know of any examples where the YUI javascript libraries have been used with code igniter...I use this library a lot and wondered if any examples exist on the net.

Thanks,

C
#2

[eluser]johnwbaxter[/eluser]
I go for the "assets" folder in the root. Works fine.

I want to put all the system files outside of the webroot as well which i'll do later (you can see how to do it somewhere in these forums)

There is a entry for yui which gives some info in the wiki - http://www.codeigniter.com/wiki

I also would like to look into using yui, i hope it goes well for you.
#3

[eluser]Carlton[/eluser]
Thanks pal...found this link > http://codeigniter.com/wiki/Using_CI_yui...velopment/
#4

[eluser]Michael Wales[/eluser]
It's really up to you, although breaking the system files out of webroot is highly recommended. Personally, I make 2 folders in root: css and images.
#5

[eluser]Carlton[/eluser]
Thanks for the advice...
So does this mean I could have something like

localhost/test_ci/

localhost/test_ci/images
localhost/test_ci/css

and maybe add the path to my code igniter system files...perhaps in C:\php-5.2.0\extras...into my include path in php.ini

Sorry if questions seem a little basic but I want to ensure that I understand the best way to approach creating a new project Smile
#6

[eluser]Michael Wales[/eluser]
No, you don't have to add the path to anything just make sure you reference the location correctly in your &lt;link&gt; and <img> tags. So if you had the folders:
localhost/test_ci/
localhost/test_ci/images
localhost/test_ci/css

Then all of your tags referencing files in those folders would look similar to this:
Code:
&lt;link rel="stylesheet" href="/test_ci/css/style.css" media="screen,projection" type="text/css" /&gt;
<img src="/test_cs/images/body_bg.jpg" />

Anytime you start a file reference with a / - it will start at your webroot, so just trace it up from there.

I'm sure you could get into using CI's config and dynamically generating the correct relative path - but why? Take the easy way out - more likely than not you will spend more time getting the dynamics to work than you ever would typing the 10 extra characters to reference from root.
#7

[eluser]usmc[/eluser]
I do something like this since the webroot will change moving from dev to production (or app to app)

**Controller
Code:
$baseURL == $this->config->item('base_url');

$data["baseURL"] = $baseURL;

$this->load->view('examples/yui', $data);


**View
Code:
&lt;link rel="stylesheet" type="text/css" href="&lt;?= $baseURL ?&gt;/css/panel/exmpale_yui_panel.css"/&gt;
&lt;link rel="stylesheet" type="text/css" href="&lt;?= $baseURL ?&gt;/css/datatable/exmpale_yui_dt.css"/&gt;
#8

[eluser]Neovive[/eluser]
Also, if you are using an .htaccess file to remove the index.php from the url, be sure to add the directory name to the list of directories in the .htaccess exclusion section if it does not already exist.
#9

[eluser]jbowman[/eluser]
use this for your .htaccess file, put the files where ever you want

Code:
RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

Also, I wrote that guide for yui a while ago, I'd do it differently now...

I'd use the new yui loader, and pull everything from yahoo!'s hosted files. Save bandwidth Smile

Honestly, that, combined with the new RTE and colorpicker, I'm seriously considering going back to YUI over ExtJS for some projects.
#10

[eluser]openology[/eluser]
Do you mind sharing how you setup and use YUI and ExtJS. I at the point of looking at how to integrate them with CI.
My thoughts is to use Extjs for layout of the backend admin while YUI works nicely for frontend components.




Theme © iAndrew 2016 - Forum software by © MyBB