img_path not working in simple module view

edited October 2011 in Modules
I'm using the news module from the pages tutorial and images added through markitup
are not showing up in the view.

However, they do appear when I preview the post in the admin area.

Blog post images are working as they should.

What might I be missing?

Comments

  • edited 3:23PM
    More info...

    I just realized the templating syntax is not being converted to straight html in the view...

    is showing in the source code.
  • edited 3:23PM
    Forgot to add code tags above...
    <img src="{img_path('authors/adidas_thumb04.jpg')}" alt="" />
  • edited 3:23PM
    Try adding the following to your model.
    public $parsed_fields = array('content', 'content_formatted');
    I've updated the tutorial to help with this: http://www.getfuelcms.com/user_guide/modules/tutorial
  • edited 3:23PM
    Thanks!! That worked.
  • edited 3:23PM
    I'm running into a similar issue and it's not resolving after having added the above $parsed_fields line. My column is "content" though it doesn't appear to be sticking. The tutorial only mentions $parsed_files twice and so I'm at a loss. Thoughts?
  • edited 3:23PM
    Any chance of you showing us the model (you can wrap in code tags)?
  • edited 3:23PM
    Hi,
    Below you can see my model , but it has not shown the image in the contents and still I just see in my html inspect element.
    Could you please help me to solve it?

    <?php if (!defined('BASEPATH')) exit('No direct script access allowed');

    require_once(FUEL_PATH.'models/base_module_model.php');

    class site_hozes_model extends Base_module_model {


    public $belongs_to = array('projects' => 'projects_model');
    public $parsed_fields = array('content', 'content_formatted');

    public $filters_join = 'or';

    function __construct()
    {
    parent::__construct('fuel_site_hoze');
    }
    function form_fields($values = array(), $related = array())
    {
    $fields = parent::form_fields($values, $related);

    // ******************* ADD CUSTOM FORM STUFF HERE *******************
    $fields['content']['img_folder'] = 'docs/images';
    $fields['image']['folder'] = 'docs/images/';
    $fields['thumb_image']['folder'] = 'docs/images';


    return $fields;
    }

    }

    class site_hoze_model extends Base_module_record {

    }
  • edited 3:23PM
    What image path is it using instead?
  • edited 3:23PM
    it does not understand the img path at all.
    and if I even write <?php echo "hi" ?> it shows exactly that and it does not understand that it is something related to php and it can not interpreted as php code.
  • edited 3:23PM
    What is the src value of the image if you view source?
  • edited January 2016
    Thanks for your supports.
    < img src="{ img_path('ab.png')}" >
    this is what I have in my view.
  • edited 3:23PM
  • edited 3:23PM
    Does it work if you remove the space between the { and "img_path"
  • edited 3:23PM
    No i just put the space myself to show it here. Actually there is no space between them
  • edited 3:23PM
    I just realized that above you said that's what you had in your view? By default, FUEL will not parse template tags in your view files. It will parse content from the database for the content field since you specified the $parsed_fields.
  • edited 3:23PM
    So why I can not see my image in my view file?
  • edited 3:23PM
    In fact it does not parse content from the database and when I write something in the texteditor and when I upload image in the texteditor in my models , I can see the texts but not he image and instead showing the image I do not have nothing in my view.
    When I use inspect element to trace my html, I just can see < img src="{ img_path('ab.png')}" >.
    Is there a way that I can fix it?
    I would highly appreciate your consideration.
  • edited 3:23PM
    I imagine that the output is being presented somehow in a view file. Does it work if you wrap it with the following in your view file:
    <?php echo $CI->fuel->parser->parse_string($site_hoze->content);?>
  • edited March 2017
    Hello all,

    I have a problem with parsing, I want to disable it. When I insert an image in content I get this:
    < img src="{img_path('small_image.jpg')}" alt="" />

    And I need this:
    < img src="http://domain.com/MY_PATH_TO_IMAGES/small_image.jpg" alt="" />

    The problem is that editor modify the URL. I must disable that but do not know how and where. Can someone help?
    I am using ckeditor, if that makes difference.
    Thanks
  • edited 3:23PM
    Can you replace the parameter value with the full http path? The img_path function should utilize that path and ignore it the generated relative path (it detects the http://).
  • edited March 2017
    I am adding images using fuel system, by selecting the image uploaded earlier.
    I nee full path of image to be written in database.
    What I need is < img scr="http://...full-image-path/image.jpg" />
    I have find out that when I add < img > manually into text (copy html and paste it), the editor script change src path to {img_path('small_image.jpg')}
    I have to avoid that.

    I have modified fuelimage plugin ckeditor/plugins/fuelimage/plugin.js to add my full path and image name:
    editor.insertHtml("< img src='http://full-domain-image-path/"+varPictureName+"'"/>);

    But other Fuel script (or editor script) change the full path. I have to resolve this. I do not know why is this happening. It does not happen for any other type of tag.

    When I just change it to add editor.insertHtml("< img src='https://upload.wikimedia.org/wikipedia/commons/9/97/The_Earth_seen_from_Apollo_17.jpg'/>;");

    It will give me this as result:
    < img src="{img_path('https://upload.wikimedia.org/wikipedia/commons/9/97/The_Earth_seen_from_Apollo_17.jpg')}" />

    How can I exclude this {img_path(' ')} from src?


    Thanks.
  • edited 3:23PM
    The code for that is in the core JS file at fuel/modules/fuel/assets/js/fuel/custom_fields.js around line 241.

    I've just pushed this fix to the develop branch:
    https://github.com/daylightstudio/FUEL-CMS/commit/2101231bc08ed81aed830a818b4938c8083031d2
  • edited 3:23PM
    Wow! That worked. I have figure out where to remove brackets "img_path('" + img + "')" but could not figure out for full url. Now works! Thanks man.
Sign In or Register to comment.