Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Need help calling JDOM in Module 07 Jul 2021 14:25 #15847

Hi,
I'm creating a module for my component and thought I would use the JDom to call up an image.

I'm using this as document page as a guide... www.j-cook.pro/index.php/m/module

My component is called com_organicshop. My image field is "main_image".

In my module default.php I have...
// Set up the component for JDom
	$dom = JDom::getInstance();
	$dom->set('extension', 'com_organicshop');
Is the "extension" bitcorrect?

Also
<?php // Item Image
	echo JDom::_('html.fly.file', array(
	   // Furnish the image relative path
	  'dataValue' => $item->main_image,				 
          // Define as indirect, with the root directory alias
	  'root' => '[DIR_FILES_MAIN_IMAGE]',
	  'indirect' => true,
          // Some options for Thumb creation
	  'height' => 50,
	  'width' => 50,
	  'attrs' => array('center','crop','fit'),								
));?>

But the JDom isn't showing the image - it is not rendering. Instead I'm getting this output...
<img src="/index.php?option=com_organicshop&amp;task=file&amp;size=50x50&amp;attrs=center:1,crop:1,fit:1&amp;path=[DIR_FILES_MAIN_IMAGE]/shoelaces.jpg">
Any ideas?
Just call me Chris :)

Please Log in or Create an account to join the conversation.

Last edit: by organicwebs.

Need help calling JDOM in Module 07 Jul 2021 14:52 #15848

I worked it out...

'indirect' needed to be "false"... and 'root' needed to be "DIR_TABLE_FIELD"
<?php // Item Image
	echo JDom::_('html.fly.file', array(
	   // Furnish the image relative path
	  'dataValue' => $item->main_image,				 
	  // Define as indirect, with the root directory alias
	  'root' => '[DIR_ITEMS_MAIN_IMAGE]',
	  'indirect' => false,
	  // Some options for Thumb creation
	  'height' => 50,
	  'width' => 50,
	  'attrs' => array('center','crop','fit'),								
));?>

Pretty nifty. B)

I'm still discovering these little gems in JCook!
Just call me Chris :)

Please Log in or Create an account to join the conversation.

Need help calling JDOM in Module 21 Jul 2021 20:59 #15849

good work :)

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.058 seconds

This is what you call a component builder. I was able to master using this in a very short time and the resulting component works like a charm. Not just a basic component builder but a fully working component builder with forms fields tables all ready to go. You can make the list and item views to display in the front and back end. Also there is a great forum just starting to evolve and I'm sure this will grow very rapidly when you all realise how good this tool is.
Kevin (JED)

         

Get Started