img_path not working in simple module view
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
I just realized the templating syntax is not being converted to straight html in the view...
is showing in the source code.
<img src="{img_path('authors/adidas_thumb04.jpg')}" alt="" />
public $parsed_fields = array('content', 'content_formatted');
I've updated the tutorial to help with this: http://www.getfuelcms.com/user_guide/modules/tutorial
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 {
}
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.
< img src="{ img_path('ab.png')}" >
this is what I have 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.
<?php echo $CI->fuel->parser->parse_string($site_hoze->content);?>
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
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.
I've just pushed this fix to the develop branch:
https://github.com/daylightstudio/FUEL-CMS/commit/2101231bc08ed81aed830a818b4938c8083031d2