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

  Merci d'avoir présenté ce service web générateur de composant joomla. L'interface est très conviviale on a le plaisir du drag&drop et c'est assez rare pour être signalé. Je souhaite que ce projet connaisse un fort succès votre réalisation est méritante.
Yann Gomiero (AFUJ - France)

Get Started