Keyword

Add item image in Users (User list)

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
4 weeks 16 hours ago #178370 by Goble002
Add item image in Users (User list) was created by Goble002
Hello,

is it possible to include the items images in /templates/my-template/html/mod_k2_users/Default/default.php (Items for user in list of users module) ?

Default template will load only k2 item titles.

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 4 days ago #178432 by Fotis
Replied by Fotis on topic Add item image in Users (User list)
Try:
<img src="<?php echo $item->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>" />

...within the foreach loop.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
2 weeks 3 days ago #178486 by Goble002
Replied by Goble002 on topic Add item image in Users (User list)
Hello Fotis and thanks !

I even tried:
<img src="<?php echo $item->imageGeneric; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>" />

The output HTML I'm getting : 
<img src="/" alt="My Item Title">
 

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 3 days ago #178494 by Fotis
Replied by Fotis on topic Add item image in Users (User list)
Depending on context the image may not be prepared. Either way I'm refactoring K2 these weeks to normalize such behaviour as I happened to stumble upon a similar issue whereby I couldn't get the image for an item's "related items" (this has already been merged in K2 v2.10.4 [dev] by the way)...

Can you please do a <?php var_dump($item); ?> within the foreach loop to see what available data you have for the item?

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
2 weeks 2 days ago #178504 by Goble002
Replied by Goble002 on topic Add item image in Users (User list)
Hi,

It just give me "NULL"

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 2 days ago #178508 by Fotis
Replied by Fotis on topic Add item image in Users (User list)
Not <?php var_dump($item->image); ?>, just <?php var_dump($item); ?>...

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
2 weeks 2 days ago #178510 by Goble002
Replied by Goble002 on topic Add item image in Users (User list)
Hi,

<?php var_dump($item); ?> in /templates/my-template/html/mod_k2_users/Default/default.php gives me NULL in output,

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 2 days ago #178512 by Fotis
Replied by Fotis on topic Add item image in Users (User list)
If it gave you null, you wouldn't get the title of the item. You must place the code WITHIN the foreach loop. That's the object's execution context.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
2 weeks 2 days ago - 2 weeks 2 days ago #178515 by Goble002
Replied by Goble002 on topic Add item image in Users (User list)
Oh I was inserting the code after the wrong "foreach"

here goes:
" ["fulltext"]=> string(0) "" ["video"]=> string(0) "" ["gallery"]=> NULL ["extra_fields"]=> string(2) "[]" ["extra_fields_search"]=> string(0) "" ["created"]=> string(19) "2005-01-02 03:04:05" ["created_by"]=> string(1) "9" ["created_by_alias"]=> string(0) "" ["checked_out"]=> string(1) "0" ["checked_out_time"]=> string(19) "0000-00-00 00:00:00" ["modified"]=> string(19) "2021-03-23 09:59:53" ["modified_by"]=> string(1) "9" ["publish_up"]=> string(19) "2005-01-02 03:04:05" ["publish_down"]=> string(19) "0000-00-00 00:00:00" ["trash"]=> string(1) "0" ["access"]=> string(1) "1" ["ordering"]=> string(1) "1" ["featured"]=> string(1) "0" ["featured_ordering"]=> string(1) "0" ["image_caption"]=> string(0) "" ["image_credits"]=> string(0) "" ["video_caption"]=> string(0) "" ["video_credits"]=> string(0) "" ["hits"]=> string(2) "34" ["params"]=> string(1916) "{"catItemTitle":"","catItemTitleLinked":"","catItemFeaturedNotice":"","catItemAuthor":"","catItemDateCreated":"","catItemRating":"","catItemImage":"","catItemIntroText":"","catItemExtraFields":"","catItemHits":"","catItemCategory":"","catItemTags":"","catItemAttachments":"","catItemAttachmentsCounter":"","catItemVideo":"","catItemVideoWidth":"","catItemVideoHeight":"","catItemAudioWidth":"","catItemAudioHeight":"","catItemVideoAutoPlay":"","catItemImageGallery":"","catItemImageGalleryWidth":"","catItemImageGalleryHeight":"","catItemDateModified":"","catItemReadMore":"","catItemCommentsAnchor":"","catItemK2Plugins":"","itemDateCreated":"","itemTitle":"","itemFeaturedNotice":"","itemAuthor":"","itemFontResizer":"","itemPrintButton":"","itemEmailButton":"","itemSocialButton":"","itemVideoAnchor":"","itemImageGalleryAnchor":"","itemCommentsAnchor":"","itemRating":"","itemImage":"","itemImgSize":"","itemImageMainCaption":"","itemImageMainCredits":"","itemIntroText":"","itemFullText":"","itemExtraFields":"","itemDateModified":"","itemHits":"","itemCategory":"","itemTags":"","itemAttachments":"","itemAttachmentsCounter":"","itemVideo":"","itemVideoWidth":"","itemVideoHeight":"","itemAudioWidth":"","itemAudioHeight":"","itemVideoAutoPlay":"","itemVideoCaption":"","itemVideoCredits":"","itemImageGallery":"","itemImageGalleryWidth":"","itemImageGalleryHeight":"","itemNavigation":"","itemComments":"","itemTwitterButton":"","itemFacebookButton":"","itemLinkedInButton":"","itemAuthorBlock":"","itemAuthorImage":"","itemAuthorDescription":"","itemAuthorURL":"","itemAuthorEmail":"","itemAuthorLatest":"","itemAuthorLatestLimit":"","itemRelated":"","itemRelatedLimit":"","itemRelatedTitle":"","itemRelatedCategory":"","itemRelatedImageSize":"","itemRelatedIntrotext":"","itemRelatedFulltext":"","itemRelatedAuthor":"","itemRelatedMedia":"","itemRelatedImageGallery":"","k2SeoGsdType":"","itemK2Plugins":""}" ["metadesc"]=> string(0) "" ["metadata"]=> string(15) "robots= author=" ["metakey"]=> string(0) "" ["plugins"]=> string(0) "" ["language"]=> string(1) "*" ["categoryname"]=> string(6) "Photos" ["categoryid"]=> string(1) "1" ["categoryalias"]=> string(6) "photos" ["categoryparams"]=> string(2880) "{"inheritFrom":"0","catMetaDesc":"","catMetaKey":"","catMetaRobots":"","catMetaAuthor":"","theme":"","num_leading_items":"2","num_leading_columns":"1","leadingImgSize":"Large","num_primary_items":"4","num_primary_columns":"2","primaryImgSize":"Medium","num_secondary_items":"4","num_secondary_columns":"1","secondaryImgSize":"Small","num_links":"4","num_links_columns":"1","linksImgSize":"XSmall","catCatalogMode":"1","catFeaturedItems":"1","catOrdering":"","catPagination":"2","catPaginationResults":"1","catTitle":"1","catTitleItemCounter":"1","catDescription":"1","catImage":"1","catFeedLink":"1","catFeedIcon":"1","subCategories":"1","subCatColumns":"2","subCatOrdering":"","subCatTitle":"1","subCatTitleItemCounter":"1","subCatDescription":"1","subCatImage":"1","itemImageXS":"","itemImageS":"","itemImageM":"","itemImageL":"","itemImageXL":"","catItemTitle":"1","catItemTitleLinked":"1","catItemFeaturedNotice":"0","catItemAuthor":"1","catItemDateCreated":"1","catItemRating":"0","catItemImage":"1","catItemIntroText":"1","catItemIntroTextWordLimit":"","catItemExtraFields":"0","catItemHits":"1","catItemCategory":"1","catItemTags":"1","catItemAttachments":"0","catItemAttachmentsCounter":"0","catItemVideo":"0","catItemVideoWidth":"","catItemVideoHeight":"","catItemAudioWidth":"","catItemAudioHeight":"","catItemVideoAutoPlay":"0","catItemImageGallery":"0","catItemImageGalleryWidth":"","catItemImageGalleryHeight":"","catItemDateModified":"0","catItemReadMore":"1","catItemCommentsAnchor":"1","catItemK2Plugins":"1","itemDateCreated":"1","itemTitle":"1","itemFeaturedNotice":"1","itemAuthor":"1","itemFontResizer":"0","itemPrintButton":"0","itemEmailButton":"0","itemSocialButton":"1","itemVideoAnchor":"1","itemImageGalleryAnchor":"1","itemCommentsAnchor":"1","itemRating":"1","itemImage":"1","itemImgSize":"XLarge","itemImageMainCaption":"0","itemImageMainCredits":"0","itemIntroText":"1","itemFullText":"0","itemExtraFields":"1","itemDateModified":"1","itemHits":"1","itemCategory":"0","itemTags":"1","itemAttachments":"0","itemAttachmentsCounter":"0","itemVideo":"0","itemVideoWidth":"","itemVideoHeight":"","itemAudioWidth":"","itemAudioHeight":"","itemVideoAutoPlay":"0","itemVideoCaption":"0","itemVideoCredits":"0","itemImageGallery":"0","itemImageGalleryWidth":"","itemImageGalleryHeight":"","itemNavigation":"1","itemComments":"1","itemTwitterButton":"1","itemFacebookButton":"1","itemLinkedInButton":"1","itemAuthorBlock":"1","itemAuthorImage":"1","itemAuthorDescription":"0","itemAuthorURL":"0","itemAuthorEmail":"0","itemAuthorLatest":"1","itemAuthorLatestLimit":"10","itemRelated":"1","itemRelatedLimit":"10","itemRelatedTitle":"1","itemRelatedCategory":"0","itemRelatedImageSize":"Small","itemRelatedIntrotext":"0","itemRelatedFulltext":"0","itemRelatedAuthor":"0","itemRelatedMedia":"0","itemRelatedImageGallery":"0","k2SeoGsdType":"","itemK2Plugins":"1"}" ["link"]=> string(19) "/photos/1-test-item" ["categoryLink"]=> string(14) "/photos/photos" }
Last edit: 2 weeks 2 days ago by Goble002.

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

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
2 weeks 2 days ago #178517 by Goble002
Replied by Goble002 on topic Add item image in Users (User list)
This before the intro text:
object(stdClass)#1061 (42) { ["id"]=> string(1) "1" ["title"]=> string(11) "Test item 1" ["alias"]=> string(9) "test-item" ["catid"]=> string(1) "1" ["published"]=> string(1) "1" ["introtext"]=> string(251) "

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


Powered by Kunena Forum