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.061 seconds

For starters it's just so easy to design an app in a way that I'm used to i.e. database first then views followed by customization. The fork system is pure brilliance from a developer standpoint as I can override things and still add and update my projects with minimal effort! Truly amazing to be able to build components in Joomla using incremental refinement without having to do everything by hand. Thanks for the great tool! I am so much more productive now than ever and I can't imagine building components any other way!!!!
Dave (Forum)

Get Started