Do I need to enable parsing for "{img_path('my_image.jpg')}" to work?

edited February 2011 in Modules
Is there a setting variable or something I need to enable for "{img_path('my_image.jpg')}" to parse when I have it in an admin textarea box?

Comments

  • edited February 2011
    If you have created a page in the admin, the parsing should automatically be applied to all layout variables. If you've created a module and want to enable parsing on certain fields, there is a $parsed_fields property in the base_module_model class (which modules extend). This should be an array of the fields you want to have parsed on output. If you are using a "magic" attribute like $myobj->content_formatted, you will need to include "content_formatted" as well as "content" in the array. Does that make sense?
  • edited 7:53AM
    Yup. That was what I was looking for. Thank you!
  • edited May 2012
    I'm a n00b to FuelCMS, and also to working in an MVC, but i'm having a similar issue I think. I am using the fuel_model object to pull in all blog_posts on a view file. In the Blog CMS, I add a new post, with an image.

    The tag looks like:

    <img src="{img_path('my_image.jpg')}" alt="" / >

    and when published, the img_path shortcode does not parse at all.

    What am I doing wrong here?
  • edited May 2012
    Also, on the same token, is there a way to handle images separately?

    Something like.. <?php echo $post->images; ?>
  • edited 7:53AM
    Try <?=parse_template_syntax($post->content)?>" or "{$post->content_formatted}"?

    With regards to the second question, there currently isn't any field in the database that stores an image name (just a field to upload images). Therefore there is no method to retrieve an image associated with a post. However, you can add an "image" field to the fuel_blog_posts table to store that image and then you can use:
    {img_path($post->image)}
Sign In or Register to comment.