0 Пользователей и 1 Гость просматривают эту тему.
  • 0 Ответов
  • 90 Просмотров
*

SuschnosT

  • Захожу иногда
  • 110
  • 1 / 2
Дать класс ссылке в EB
« : 07.05.2019, 09:12:57 »
Народ всем привет в EasyBlog пытаюсь дать класс ссылке отвечающей за подкатегорию но ничего не происходит, помогите кто знает!
Код:
Код
<?php if (!empty($category->nestedLink) && $viewOptions->subcategories) { ?>
<div class="eb-category-bio">
<?php echo $category->nestedLink; ?>
</div>
<?php } ?>

класс такого вида не подходит:

Код
<span><?php echo $category->nestedLink; ?></span>
Потому что он глобально применяется ко всем ссылкам, а не для каждой по отдельности. Внутри файлов EB по поиску "nestedLink" нашел следующее:

Файл: categories.php

Код
<?php
/**
* @package EasyBlog
* [member=126442]copyright[/member] Copyright (C) 2010 - 2014 Stack Ideas Sdn Bhd. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* EasyBlog is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');

class EasyBlogFormatterCategories extends EasyBlogFormatterStandard
{
public function execute()
{
if (!$this->items) {
return $this->items;
}

$config = EB::config();
$limit = EB::call('Pagination', 'getLimit');

$cacheOptions = array('cachePosts' => true, 'cacheAuthors' => true, 'cacheAuthorCount' => false);

if (isset($this->options['cachePosts']) && !$this->options['cachePosts']) {
$cacheOptions['cachePosts'] = false;
}

if (isset($this->options['cacheAuthors']) && !$this->options['cacheAuthors']) {
$cacheOptions['cacheAuthors'] = false;
}

if (isset($this->options['cacheAuthorsCount']) && !$this->options['cacheAuthorsCount']) {
$cacheOptions['cacheAuthorsCount'] = true;
}

// lets cache these categories
EB::cache()->insertCategories($this->items, $cacheOptions);

$categories = array();

// Get the category model
$model = EB::model('Category');

foreach ($this->items as $row) {

// We want to load the table objects
$category = EB::table('Category');
$category->bind($row);

// binding the extra info
if (isset($row->cnt)) {
$category->cnt = $row->cnt;
}

// Format the childs
$category->childs = array();

// Build childs list
EB::buildNestedCategories($category->id, $category, false, true);


// Parameterize initial subcategories to display. Ability to configure from backend.
$nestedLinks = '';
$subcategoryLimit = $this->app->getCfg('list_limit') == 0 ? 5 : $this->app->getCfg('list_limit');

if (count($category->childs) > $subcategoryLimit) {

$initialNestedLinks = '';
$initialRow = new stdClass();
$initialRow->childs = array_slice($category->childs, 0, $subcategoryLimit);

EB::accessNestedCategories($initialRow, $initialNestedLinks, '0', '', 'link', ', ');

$moreNestedLinks = '';
$moreRow = new stdClass();
$moreRow->childs = array_slice($category->childs, $subcategoryLimit);

EB::accessNestedCategories($moreRow, $moreNestedLinks, '0', '', 'link', ', ');

// Hide more nested links until triggered
$nestedLinks .= $initialNestedLinks;
$nestedLinks .= '<span class="more-subcategories-toggle" data-more-categories-link> ' . JText::_('COM_EASYBLOG_AND'). ' <a href="javascript:void(0);">' . JText::sprintf('COM_EASYBLOG_OTHER_SUBCATEGORIES', count($category->childs) - $subcategoryLimit). '</a></span>';
$nestedLinks .= '<span class="more-subcategories" style="display: none;" data-more-categories>, ' . $moreNestedLinks . '</span>';

} else {
EB::accessNestedCategories($category, $nestedLinks, '0', '', 'link', ' ');
}

// Set the nested links
$category->nestedLink = $nestedLinks;

// Get a list of nested categories and itself.
$filterCategories = array($category->id);
EB::accessNestedCategoriesId($category, $filterCategories);

// Get a list of blog posts from this category
$blogs = array();

// we need to get the setting from themes instead as
// the configuration can be override by menu item.

$themes = EB::themes();
$showPosts = $themes->getParam('category_posts');
$showAuthors = $themes->getParam('category_authors');

if ($showPosts) {

if (EB::cache()->exists($category->id, 'cats')) {
$data = EB::cache()->get($category->id, 'cats');

if (isset($data['post'])) {
$blogs = $data['post'];
}

} else {
$blogs = $model->getPosts($filterCategories, $limit);
}

// Format the blog posts
$options = array(
'cacheComment' => false,
'cacheCommentCount' => false,
'cacheRatings' => false,
'cacheVoted' => false,
'cacheTags' => false,
'cacheAuthors' => false,
'loadAuthor' => false
);

$blogs = EB::formatter('list', $blogs, true, $options);

}

// Assign other attributes to the category object
$category->blogs = $blogs;

// Get the total number of posts in the category
if (! isset($category->cnt)) {
$category->cnt = $model->getTotalPostCount($filterCategories);
}

// Get a list of active authors within this category.
$category->authors = array();
$category->authorsCount = array();
if ($showAuthors) {
// $category->authors = $category->getActiveBloggers();
$category->authorsCount = $category->getActiveAuthorsCount();
}

// Check isCategorySubscribed
$category->isCategorySubscribed = $model->isCategorySubscribedEmail($category->id, $this->my->email);

// We need to get the subscription id
$category->subscriptionId = false;

if ($category->isCategorySubscribed) {
$subscriptionModel = EB::model('Subscription');
$category->subscriptionId = $subscriptionModel->getSubscriptionId($this->my->email, $category->id, EBLOG_SUBSCRIPTION_CATEGORY);
}

$categories[] = $category;
}

return $categories;
}
}

Файл категорий целеком:

Код
<?php
/**
* @package  EasyBlog
* [member=126442]copyright[/member] Copyright (C) 2010 - 2018 Stack Ideas Sdn Bhd. All rights reserved.
* @license  GNU/GPL, see LICENSE.php
* EasyBlog is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
?>
<div class="eb-category-profile hronos72">
<?php if ($this->config->get('layout_categoryavatar', true) && $viewOptions->avatar) { ?>
<div class="col-cell cell-tight eb-category-thumb">
<a href="<?php echo $category->getPermalink(); ?>" class="eb-avatar">
<img src="<?php echo $category->getAvatar();?>" align="top" width="60" height="60" alt="<?php echo $category->getTitle();?>" />
</a>
</div>
<?php } ?>

<div class="col-cell eb-category-details">
<?php if ($viewOptions->title) { ?>

<?php } ?>

<div class="eb-category-subscribe spans-seperator">
<?php if ((($category->private && $this->my->id != 0) || ($this->my->id == 0 && $this->config->get('main_allowguestsubscribe')) || !$this->my->guest) && $this->config->get('main_categorysubscription') && $viewOptions->subscription && $this->acl->get('allow_subscription')) { ?>
<span class="eb-category-subscription">
<a href="javascript:void(0);" class="link-subscribe <?php echo $category->isCategorySubscribed ? 'hide' : ''; ?>"
data-blog-subscribe data-type="category" data-id="<?php echo $category->id;?>"
data-eb-provide="tooltip""
>
<i class="btt11 fa fa-envelope"></i>
</a>
<a href="javascript:void(0);" class="link-subscribe <?php echo $category->isCategorySubscribed ? '' : 'hide'; ?>"
data-blog-unsubscribe data-subscription-id="<?php echo $category->isCategorySubscribed ? $category->isCategorySubscribed : '';?>" data-return="<?php echo base64_encode(EBFactory::getURI(true));?>"
data-eb-provide="tooltip" title="<?php echo JText::_('COM_EASYBLOG_SUBSCRIPTION_UNSUBSCRIBE_CATEGORY', true);?>"
>
<i class="fa fa-envelope"></i>
</a>
</span>
<?php } ?>

<?php if ($this->config->get('main_rss') && $this->acl->get('allow_subscription_rss') && $viewOptions->rss) { ?>
<a target = "_blank" href="<?php echo $category->getRssLink();?>">
<i class="btt11 fa fa-rss"></i>
</a>

<a href="<?php echo $category->getPermalink();?>">
<i class="btt11 fa fa-plus"></i>
</a>

<?php } ?>
</div>
</div>
</div>

<?php if ($viewOptions->description && $category->description) { ?>
<div class="eb-category-bio">
<a href="<?php echo $category->getPermalink();?>" class="mb2221 text-inherit">— <?php echo $category->getTitle();?></a> <span class="hyphenate" lang="ru"><?php echo $this->html('string.truncater', nl2br(strip_tags($category->description)), 350); ?></span>
</div>
<?php } ?>

<?php if (!empty($category->nestedLink) && $viewOptions->subcategories) { ?>
<div class="hronos74 eb-category-bio hronos71">
<span><?php echo $category->nestedLink; ?></span>
</div>
<?php } ?>


Заранее спасибо.


Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Добавить класс во второй уровень меню

Автор kolhoz

Ответов: 4
Просмотров: 195
Последний ответ 26.03.2019, 09:39:40
от fbr
Как дать право редактировать КМу чужие записи и входа на сайт?

Автор Karyuudo

Ответов: 1
Просмотров: 125
Последний ответ 28.02.2019, 19:58:32
от Karyuudo
Как убрать посторонние символы в ссылке пагинации?start=?

Автор Kostuk

Ответов: 13
Просмотров: 534
Последний ответ 14.02.2019, 21:41:19
от Juseppe
Добавление класса current к активной якорной ссылке меню

Автор semak85

Ответов: 1
Просмотров: 165
Последний ответ 21.12.2018, 10:14:56
от effrit
К пункту меню на внешний URL к ссылке добавить код вызова скрипта

Автор Bozhkov2

Ответов: 11
Просмотров: 522
Последний ответ 14.12.2018, 23:04:48
от robert