src attribute of img tag referencing wrong location |
[eluser]johnmerlino[/eluser]
Hey all, I have a helper method that gets called: Code: echo img('../public/images/' . $image->image_file_name, 'img_class'); If I am on page http://localhost/blogs/johnmerlino/category/3 That src attribute ends up pointing to: http://localhost/blogs/johnmerlino/public/images/a.jpg even though I want it to point to: http://localhost/system/application/public/images/a.jpg Thanks for response.
[eluser]toopay[/eluser]
based by your approach : Code: function img($path = '', $class = '', $attributes = array()) Code: echo img('public/images/' . $image->image_file_name, 'img_class');
[eluser]toopay[/eluser]
Opps, sorry for that unreadable crap, forgot to use Post Replies instead Fast Replies, here you go : Code: function img($path = '', $class = '', $attributes = array())
[eluser]toopay[/eluser]
Actually, in my opinion, it will be more 'clean' this way : Code: function img($args = array()) Code: echo img(array('src'=>'public/images/'. $image->image_file_name, 'alt'=>'some caption','width'=>100));
[eluser]InsiteFX[/eluser]
@toopay You put the code tags in without going to POST_REPLY! Remove the backslash! Code: // [code] InsiteFX
[eluser]johnmerlino[/eluser]
@toopay thanks for response and the helpful alternative helper.
|
Welcome Guest, Not a member yet? Register Sign In |