Welcome Guest, Not a member yet? Register   Sign In
Asset Helper for Dummies
#1

[eluser]Cozmika[/eluser]
I've read few texts about that and forum threads but it just isn't working for me.

Where exactly should I make the Assets folder and what should I have in it and how to link css, images or js files?

I'm new in CI so I would really appreciate any help!
Tnx in advance

EDIT: I found this http://github.com/philsturgeon/codeigniter-asset
When I put
Code:
<?php css_path('style.css'); ?>
in my view file it says:
Code:
Fatal error: Call to undefined function css_path()
How to properly use it?
#2

[eluser]bretticus[/eluser]
[quote author="Cozmika" date="1258008034"]I've read few texts about that and forum threads but it just isn't working for me.

Where exactly should I make the Assets folder and what should I have in it and how to link css, images or js files?

I'm new in CI so I would really appreciate any help!
Tnx in advance[/quote]

I'[ll let someone else explain Phils asset helper...

Ugly site, good tutorial on paths.
#3

[eluser]Thorpe Obazee[/eluser]
@ Cozmika. You can try using the HTML base tag

http://pinoytech.org/blog/post/codeignit...l-base-tag
#4

[eluser]Cozmika[/eluser]
That can be temporary solution but I have images, javascript and more css files... This Phil's assets seem like something I need but only if I could figure why this isn't working with me...
#5

[eluser]bretticus[/eluser]
[quote author="Cozmika" date="1258008034"]
EDIT: I found this http://github.com/philsturgeon/codeigniter-asset
When I put
Code:
<?php css_path('style.css'); ?>
in my view file it says:
Code:
Fatal error: Call to undefined function css_path()
How to properly use it?[/quote]

You don't need this asset helper really, a modest amount of research would yield that you can use the root slash / in all your markup:

ie. <img src="/assets/images/myimage.jpg">

notice the / before assets. This means look in the root of my website for the assets folder. Because you may have several url segments, this is the only sure way to path your media files correctly.

Phil's helper probably just does something similar for you. Speaking of..have you loaded the helper? $this->load->helper('asset')

btw you need to echo out the result for css_path() when you get the helper loaded.
#6

[eluser]Cozmika[/eluser]
Then I will try with @bargainph advice... Tnx

EDIT: It works really nice =D




Theme © iAndrew 2016 - Forum software by © MyBB