Welcome Guest, Not a member yet? Register   Sign In
Paths with Smarty templates
#1

[eluser]Ed Robindon[/eluser]
Hi All,

New to CI but I have implemented XAJAX and Smarty in the framework. They really work nice inside of CI controllers and views.

Using Smarty one just puts link and script tags in the header tags of the template files.

The problem I am having is where do I put my js and css files so that CI
will find them. Right now using a WAMP server and put these files in folders underneath wamp/www/. It works but is not too esthetically pleasing.

Any thoughts?

Thanks,
Ed
#2

[eluser]Aken[/eluser]
You'd put them in whatever public web folder is appropriate. For instance, if mamp/www is the main folder that http://localhost points to, then you can put them anywhere inside of there. If your application is in a subfolder of the web root, put them in the subfolder. If you can install and use CodeIgniter, you should be able to figure out a folder structure for your assets Wink
#3

[eluser]Ed Robindon[/eluser]
So I created wamp/www/assets and put js,images,css and other libs in it. This works and I'll go with it for a time. It would work on the hosted site.

My layout is
wamp/www/codeigniter
...

If I put the assets folder in the codeigniter folder , they are not recognized.
#4

[eluser]Aken[/eluser]
It's probably just an issue with relative URLs - looking for your assets in the wrong place.

Here is a typical base structure I use for CI apps:
Code:
root/
- assets/
-- css/
-- js/
-- img/
- application/
-- config/
-- controllers/
-- etc…
- system/
-- etc…
- index.php
- favicon.png
- etc…
Root just indicates the encapsulating folder - it could be the actual root of a domain, a subfolder, etc...
#5

[eluser]Ed Robindon[/eluser]
Thanks Aken. I'll play with it some more.
#6

[eluser]Ed Robindon[/eluser]
Well, turns out it was my htaccess coding.

Initially used the file included with CI.

Now use:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

and life is good again.

Thanks for your help.
#7

[eluser]Aken[/eluser]
Cheers!




Theme © iAndrew 2016 - Forum software by © MyBB