Доброго дня. Как вывести в модуле автора материла? Модуль SJ Listing Tabs for K2 стандартная запись Код (PHP): <?php echo $this->item->author->name; ?> не работает
Смотреть, как вообще выводятся данные и затем уже подставлять. Возможно придется дорабатывать модуль (SQL-запрос) и т.п.
1) где можно посмотреть (helper.php или сам скрипт модуля?) 2) если можно пример sql-запроса, мб сам додумаю, хотя шансов мало Знаний php минимум, обычно доделываю методом подстановки и исключения)
Вот Код (PHP): <!--[if lt IE 9]> <div id="<?php echo $tag_id; ?>" class="sj-listing-tabs msie default1 lt-ie9 first-load"><![endif]--> <!--[if IE 9]> <div id="<?php echo $tag_id; ?>" class="sj-listing-tabs msie default1 first-load"><![endif]--> <!--[if gt IE 9]><!--> <div id="<?php echo $tag_id; ?>" class="sj-listing-tabs default1 first-load container"><!--<![endif]--> <?php if (!empty($options->pretext)) { ?> <div class="pre-text"><?php echo $options->pretext; ?></div> <?php } ?> <div class="ltabs-wrap "> <!--Begin Tabs--> <div class="ltabs-tabs-container" data-delay="<?php echo $params->get('delay', 300); ?>" data-duration="<?php echo $params->get('duration', 600); ?>" data-effect="<?php echo $params->get('effect'); ?>" data-ajaxurl="<?php echo (string)JURI::getInstance(); ?>" data-modid="<?php echo $module->id; ?>"> <?php require JModuleHelper::getLayoutPath($module->module, $layout . '_tabs'); ?> </div> <!-- End Tabs--> <div class="ltabs-items-container"><!--Begin Items--> <?php foreach ($tabs as $index => $items) { $index = $items->id; $child_items = isset($index) ? $index : ''; $cls_device = $class_ltabs; $cls_animate = $params->get('effect'); $cls = (isset($items->sel) && $items->sel == "sel") ? ' ltabs-items-selected ltabs-items-loaded' : ''; $cls .= ($index == "*") ? ' items-category-all' : ' items-category-' . $index; ?> <div class="ltabs-items <?php echo $cls; ?>" data-total="<?php echo $items->countI;?>"> <?php if ($params->get('type_show') == 'loadmore'){ ?> <div class="ltabs-items-inner <?php echo $cls_device . ' '; echo $cls_animate; ?>"> <?php }else if($params->get('type_show') == 'slider'){ ?> <div class="ltabs-items-inner owl2-carousel ltabs-slider "> <?php }else if($params->get('type_show') == 'responsive'){ if($index == '*'){$name_id = 'all';}else{$name_id = $index;} ?> <div class="grid3d vertical" id="grid3d_<?php echo $name_id;?>"> <div class="grid-wrap" data-total="<?php echo $items->countI;?>"> <?php $class_respl= 'sj-respl01-'.$params->get('nb-column1',6).' sj-respl02-'.$params->get('nb-column2',4).' sj-respl03-'.$params->get('nb-column3',2).' sj-respl04-'.$params->get('nb-column4',1) ?> <div data-field="<?php echo $items->id;?>" class="ltabs-items-inner sj-k2-responsive-content grid <?php echo $class_respl?> <?php echo ($params->get('loadmore_type') == 0)?'loadmore-click':'';?>"> <?php $list = isset($items->child) ? $items->child : ''; if (!empty($list)) { foreach($list as $item){ $_link = $item->link; $_link .= (strpos($item->link,'?'))?'&tmpl=component':'?tmpl=component'; $img = K2ListingTabsHelper::getK2Image($item, $params); ?> <div class="responsive-content-box" data-link="<?php echo $_link; ?>" data-link2="<?php echo $item->link; ?>"> <div class="responsive-content-box-inner"> <div class="responsive-content-box-bg"> <div class="item <?php echo "id".$item->id?>"> <?php $img = K2ListingTabsHelper::getK2Image($item, $params); if($img){ ?> <div class="item-img"> <?php echo K2ListingTabsHelper::imageTag($img); ?> <div class="item-img-mask"></div> <div class="item-spacer"></div> </div> <?php }?> <div class="item-info"> <?php if($params->get('itemDateCreated', 1) == 1 || $params->get('itemHits',1) == 1 || $params->get('itemCommentsCounter',1) == 1) {?> <div class="item-caption"> <?php if($item->categoryname) {?> <span class="item-category pull-left"> <?php echo $item->categoryname; ?> </span> <?php }?> <?php if($params->get('itemDateCreated',1) == 1) {?> <span class="item-date pull-right"> <?php echo JHTML::_('date', $item->created,JText::_('DATE_FORMAT_LC3')) ?> </span> <?php }?> </div> <?php } ?> <?php if($params->get('itemTitle',1) == 1){?> <h4 class="item-title"> <?php echo K2ListingTabsHelper::truncate($item->title, $params->get('itemTitleWordLimit',25), ''); ?> </h4> <?php } ?> <?php if($params->get('itemIntroText', 1) == 1 && $item->displayIntrotext !='') {?> <div class="item-desc"> <?php echo K2ListingTabsHelper::truncate($item->displayIntrotext, $params->get('item_desc_max_characs',50), ''); ?> </div> <?php }?> <?php if($params->get('item_readmore_display', 0) == 1){?> <div class="item-readmore"> <a href="<?php echo $item->link ?>" <?php echo K2ListingTabsHelper::parseTarget($options->item_link_target);?> title="<?php echo $item->title?>" > <?php echo $params->get('item_readmore_text','read more..') ?> </a> </div> <?php } ?> </div> </div> <div class="responsive-content-box-mask"> </div> <?php if ($options->item_link_target=='_windowopen'){ $link = $item->link; $link .= (strpos($item->link,'?'))?'&tmpl=component':'?tmpl=component'; ?> <a class="mask-img fancybox fancybox.iframe <?php echo ($img)?'':'item-img-mask'?>" data-fancybox-group="gallery" href="<?php echo $link; ?>" title="<?php echo $item->title;?> "></a> <?php } else {?> <a class="mask-img <?php echo ($img)?'':'item-img-mask'?>" href="<?php echo $item->link ?>#prettyPhoto[bkpGallery]/0/" <?php echo K2ListingTabsHelper::parseTarget($options->item_link_target);?> title="<?php echo $item->title?>" ></a> <?php }?> </div> </div> </div> <?php } } ?>
вот и пробуй Код (PHP): <?php echo $item->author->name;?> или сделай Код (PHP): <?php var_dump($item);?> и смотри, что вообще есть в $item
Это не работает, проверял) Код (PHP): <?php var_dump($item);?> а это где высветиться инфа? --- добавлено: 13.02.2016 --- а все, понял, смотрю) --- добавлено: 13.02.2016, первое сообщение размещено: 13.02.2016 --- Код (PHP): object(stdClass)#2011 (46) { ["id"]=> string(3) "458" ["title"]=> string(7) "Glamour" ["alias"]=> string(7) "glamour" ["catid"]=> string(3) "133" ["published"]=> string(1) "1" ["introtext"]=> string(0) "" ["fulltext"]=> string(0) "" ["video"]=> NULL ["gallery"]=> string(22) "{gallery}458{/gallery}" ["extra_fields"]=> string(2) "[]" ["extra_fields_search"]=> string(0) "" ["created"]=> string(19) "2016-02-11 17:53:45" ["created_by"]=> string(3) "635" ["created_by_alias"]=> string(0) "" ["checked_out"]=> string(1) "0" ["checked_out_time"]=> string(19) "0000-00-00 00:00:00" ["modified"]=> string(19) "0000-00-00 00:00:00" ["modified_by"]=> string(1) "0" ["publish_up"]=> string(19) "2016-02-11 17:53:45" ["publish_down"]=> string(19) "0000-00-00 00:00:00" ["trash"]=> string(1) "0" ["access"]=> string(1) "1" ["ordering"]=> string(1) "9" ["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) "59" ["params"]=> string(1787) "{"catItemTitle":"","catItemTitleLinked":"","catItemFeaturedNotice":"","catItemAuthor":"","catItemDateCreated":"","catItemRating":"","catItemImage":"","catItemIntroText":"","catItemExtraFields":"","catItemHits":"","catItemCategory":"","catItemTags":"","catItemAttachments":"","catItemAttachmentsCounter":"","catItemVideo":"","catItemVideoWidth":"","catItemVideoHeight":"","catItemAudioWidth":"","catItemAudioHeight":"","catItemVideoAutoPlay":"","catItemImageGallery":"","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":"","itemNavigation":"","itemComments":"","itemTwitterButton":"","itemFacebookButton":"","itemGooglePlusOneButton":"","itemAuthorBlock":"","itemAuthorImage":"","itemAuthorDescription":"","itemAuthorURL":"","itemAuthorEmail":"","itemAuthorLatest":"","itemAuthorLatestLimit":"","itemRelated":"","itemRelatedLimit":"","itemRelatedTitle":"","itemRelatedCategory":"","itemRelatedImageSize":"","itemRelatedIntrotext":"","itemRelatedFulltext":"","itemRelatedAuthor":"","itemRelatedMedia":"","itemRelatedImageGallery":"","itemK2Plugins":""}" ["metadesc"]=> string(0) "" ["metadata"]=> string(15) "robots= author=" ["metakey"]=> string(0) "" ["plugins"]=> string(0) "" ["language"]=> string(1) "*" ["lastChanged"]=> string(19) "2016-02-11 17:53:45" ["categoryname"]=> string(7) "Fashion" ["categoryid"]=> string(3) "133" ["categoryalias"]=> string(7) "fashion" ["categoryparams"]=> string(2744) "{"inheritFrom":"0","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":"0","catFeaturedItems":"1","catOrdering":"","catPagination":"2","catPaginationResults":"1","catTitle":"0","catTitleItemCounter":"0","catDescription":"0","catImage":"0","catFeedLink":"0","catFeedIcon":"0","subCategories":"0","subCatColumns":"2","subCatOrdering":"","subCatTitle":"0","subCatTitleItemCounter":"0","subCatDescription":"0","subCatImage":"0","itemImageXS":"","itemImageS":"","itemImageM":"","itemImageL":"","itemImageXL":"","catItemTitle":"0","catItemTitleLinked":"0","catItemFeaturedNotice":"0","catItemAuthor":"0","catItemDateCreated":"0","catItemRating":"0","catItemImage":"0","catItemIntroText":"0","catItemIntroTextWordLimit":"","catItemExtraFields":"0","catItemHits":"0","catItemCategory":"0","catItemTags":"0","catItemAttachments":"0","catItemAttachmentsCounter":"0","catItemVideo":"0","catItemVideoWidth":"","catItemVideoHeight":"","catItemAudioWidth":"","catItemAudioHeight":"","catItemVideoAutoPlay":"0","catItemImageGallery":"0","catItemDateModified":"0","catItemReadMore":"0","catItemCommentsAnchor":"0","catItemK2Plugins":"1","itemDateCreated":"0","itemTitle":"1","itemFeaturedNotice":"0","itemAuthor":"0","itemFontResizer":"0","itemPrintButton":"0","itemEmailButton":"0","itemSocialButton":"0","itemVideoAnchor":"0","itemImageGalleryAnchor":"0","itemCommentsAnchor":"0","itemRating":"0","itemImage":"0","itemImgSize":"Large","itemImageMainCaption":"0","itemImageMainCredits":"0","itemIntroText":"1","itemFullText":"1","itemExtraFields":"0","itemDateModified":"0","itemHits":"0","itemCategory":"0","itemTags":"0","itemAttachments":"0","itemAttachmentsCounter":"0","itemVideo":"0","itemVideoWidth":"","itemVideoHeight":"","itemAudioWidth":"","itemAudioHeight":"","itemVideoAutoPlay":"0","itemVideoCaption":"0","itemVideoCredits":"0","itemImageGallery":"1","itemNavigation":"0","itemComments":"0","itemTwitterButton":"0","itemFacebookButton":"0","itemGooglePlusOneButton":"0","itemAuthorBlock":"0","itemAuthorImage":"0","itemAuthorDescription":"0","itemAuthorURL":"0","itemAuthorEmail":"0","itemAuthorLatest":"0","itemAuthorLatestLimit":"5","itemRelated":"0","itemRelatedLimit":"5","itemRelatedTitle":"0","itemRelatedCategory":"0","itemRelatedImageSize":"0","itemRelatedIntrotext":"0","itemRelatedFulltext":"0","itemRelatedAuthor":"0","itemRelatedMedia":"0","itemRelatedImageGallery":"0","itemK2Plugins":"1","catMetaDesc":"","catMetaKey":"","catMetaRobots":"","catMetaAuthor":""}" ["link"]=> string(33) "/" ["tags"]=> string(0) "" ["displayIntrotext"]=> string(0) "" ["numOfvotes"]=> string(18) "(0 голосов)" ["votingPercentage"]=> int(0) }
к сожалению я это знаю Процесс идет медленно. Да и в 90% случаев мне вполне хватает того минимума, что есть. Да и те редко возникают. Спасибо, что потратили на меня время Попробую накопать узконаправленную информацию