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

fsniper

  • Осваиваюсь на форуме
  • 17
  • 0 / 0
Вопрос по Title
« : 15.10.2012, 02:43:42 »
Здравствуйте.

Имеем сайт на Joomla 2.5, как можно добавить title как материалам из названия категории.
К примеру, что бы получилось так.
Как ловить рыбку(название материала) - Про рыбалку(Название Категории)

Просто уже есть множество категорий и много материалов, не хочется редактировать каждый материал отдельно и приписывать в TITLE название категории, может есть какое решение?
*

fedragon

  • Захожу иногда
  • 232
  • 22 / 0
  • You move like an insect
Re: Вопрос по Title
« Ответ #1 : 15.10.2012, 05:24:26 »
templates->ваш шаблон->html->con_content->article->default.php
Добавьте к выводу названия материала вывод названия категории (category_title).

Если не знаете как - выложите сюда весь код из default.php, поправим :)
Your flesh is an insult to the perfection of the digital.
*

fsniper

  • Осваиваюсь на форуме
  • 17
  • 0 / 0
Re: Вопрос по Title
« Ответ #2 : 15.10.2012, 14:04:07 »
Код
<?php
defined('_JEXEC') or die;

require_once dirname(__FILE__). str_replace('/', DIRECTORY_SEPARATOR, '/../../../functions.php');

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');

$component = new ArtxContent($this, $this->params);
$article = $component->article('article', $this->item, $this->item->params, array('print' => $this->print));

echo $component->beginPageContainer('item-page');
if (strlen($article->pageHeading))
    echo $component->pageHeading($article->pageHeading);
$params = $article->getArticleViewParameters();
if (strlen($article->title)) {
    $params['header-text'] = $this->escape($article->title);
    if (strlen($article->titleLink))
        $params['header-link'] = $article->titleLink;
}
// Change the order of "if" statements to change the order of article metadata header items.
if (strlen($article->created))
    $params['metadata-header-icons'][] = "<span class=\"art-postdateicon\">" . $article->createdDateInfo($article->created). "</span>";
if (strlen($article->modified))
    $params['metadata-header-icons'][] = "<span class=\"art-postdateicon\">" . $article->modifiedDateInfo($article->modified). "</span>";
if (strlen($article->published))
    $params['metadata-header-icons'][] = "<span class=\"art-postdateicon\">" . $article->publishedDateInfo($article->published). "</span>";
if ($article->printIconVisible)
    $params['metadata-header-icons'][] = $article->printIcon();
if ($article->emailIconVisible)
    $params['metadata-header-icons'][] = $article->emailIcon();
if ($article->editIconVisible)
    $params['metadata-header-icons'][] = $article->editIcon();
if (strlen($article->hits))
    $params['metadata-header-icons'][] = $article->hitsInfo($article->hits);
// Build article content
$content = '';
if ('above full article' === $article->paginationPosition)
    $content .= $article->pagination();
if (!$article->introVisible)
    $content .= $article->event('afterDisplayTitle');
$content .= $article->event('beforeDisplayContent');
if (strlen($article->toc))
    $content .= $article->toc($article->toc);
if (strlen($article->text)) {
    if (strlen($article->images['fulltext']['image']))
        $content .= $article->image($article->images['fulltext']);
    if ('above text' === $article->paginationPosition)
        $content .= $article->pagination();
    $content .= $article->text($article->text);
    if ('below text' === $article->paginationPosition)
        $content .= $article->pagination();
    if ($article->showLinks)
        $content .= $this->loadTemplate('links');
}
if ($article->introVisible)
    $content .= $article->intro($article->intro);
if (strlen($article->readmore))
    $content .= $article->readmore($article->readmore, $article->readmoreLink);
if ('below full article' === $article->paginationPosition)
    $content .= $article->pagination();
$content .= $article->event('afterDisplayContent');
$params['content'] = $content;
// Change the order of "if" statements to change the order of article metadata footer items.
if (strlen($article->category))
  $params['metadata-footer-icons'][] = "<span class=\"art-postcategoryicon\">"
    . $article->categories($article->parentCategory, $article->parentCategoryLink, $article->category, $article->categoryLink)
    . "</span>";

// Render article
echo $article->article($params);
echo $component->endPageContainer();

Вот, спасибо заранее.

А других методов нету подобных? Может плагином или ещё чем?
*

fedragon

  • Захожу иногда
  • 232
  • 22 / 0
  • You move like an insect
Re: Вопрос по Title
« Ответ #3 : 15.10.2012, 16:26:31 »
Эка какой интересный шаблон. Не знаю точно, будет ли тут работать, попробуйте так:

Вот этот кусок
Код
if (strlen($article->title)) {
    $params['header-text'] = $this->escape($article->title);
    if (strlen($article->titleLink))
        $params['header-link'] = $article->titleLink;
}

заменить на этот

Код
if (strlen($article->title)) {
    $params['header-text'] = ($this->escape($article->title)). ' - ' . ($this->escape($article->category_title));
    if (strlen($article->titleLink))
        $params['header-link'] = ($article->titleLink). ' - ' . ($this->escape($article->category_title));
}

Насчёт плагинов не знаю, ищите на extensions.joomla.org
Your flesh is an insult to the perfection of the digital.
*

fsniper

  • Осваиваюсь на форуме
  • 17
  • 0 / 0
Re: Вопрос по Title
« Ответ #4 : 15.10.2012, 17:09:56 »
Нет, это мы не то изменили, может в другом файле что копать надо?
Т.к изменился заголовок статей, и то не до конца,
К примеру к тексту заголовка добавилось тире.
Рыбалка в море -

И при нажатии же по заголовку получаем ссылку вида
"http://site.ru/ribalka.html - "

p.s шаблон сделан в лицензинном артистере, может кто знает где в настройках есть что? сейчас попробую ещё в поддержку написать, может подскажут.
« Последнее редактирование: 15.10.2012, 17:15:08 от fsniper »
*

NortonFox

  • Захожу иногда
  • 441
  • 43 / 0
Re: Вопрос по Title
« Ответ #5 : 15.10.2012, 17:14:25 »
А если не секрет, зачем это надо?
Я знаю только то, что ничего не знаю
*

fsniper

  • Осваиваюсь на форуме
  • 17
  • 0 / 0
Re: Вопрос по Title
« Ответ #6 : 15.10.2012, 17:15:49 »
А если не секрет, зачем это надо?

для сео... у меня просто не разбериха какая то получается а то на сайте.
*

fedragon

  • Захожу иногда
  • 232
  • 22 / 0
  • You move like an insect
Re: Вопрос по Title
« Ответ #7 : 15.10.2012, 17:28:05 »
Ага, понятненько.

Правильней так:
Код
if (strlen($article->title)) {
    $params['header-text'] = ($this->escape($article->title)). ' - ' . ($this->escape($article->category_title));
    if (strlen($article->titleLink))
        $params['header-link'] = $article->titleLink;
}

А вот почему он category_title не цепляет, не пойму я
Your flesh is an insult to the perfection of the digital.
*

fsniper

  • Осваиваюсь на форуме
  • 17
  • 0 / 0
Re: Вопрос по Title
« Ответ #8 : 15.10.2012, 18:05:23 »
Нет, не помогло, может все же в другом файле? Т.к титле вообще не изменяется.
*

fsniper

  • Осваиваюсь на форуме
  • 17
  • 0 / 0
Re: Вопрос по Title
« Ответ #9 : 15.10.2012, 18:08:09 »
В поддержке сказали вот что...
Цитировать
В Artisteer это не контролируется, хотя, как я понимаю, необходимо будет действительно внести изменения в шаблон, а именно в строку вывода слогана в файле index.php.
Но мы не поддерживаем кастомные модификации, так что можете обратиться на наш форум, возможно, там вам подскажут решение.
Код
<?php
defined('_JEXEC') or die;

require_once dirname(__FILE__). DIRECTORY_SEPARATOR . 'functions.php';

// Create alias for $this object reference:
$document = $this;

// Shortcut for template base url:
$templateUrl = $document->baseurl . '/templates/' . $document->template;

// Initialize $view:
$view = $this->artx = new ArtxPage($this);

// Decorate component with Artisteer style:
$view->componentWrapper();

JHtml::_('behavior.framework', true);

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="<?php echo $document->language; ?>" xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $document->language; ?>">
<head>
 <jdoc:include type="head" />
 <link rel="stylesheet" href="<?php echo $document->baseurl; ?>/templates/system/css/system.css" type="text/css" />
 <link rel="stylesheet" href="<?php echo $document->baseurl; ?>/templates/system/css/general.css" type="text/css" />
 <link rel="stylesheet" type="text/css" href="<?php echo $templateUrl; ?>/css/template.css" media="screen" />
 <!--[if IE 6]><link rel="stylesheet" href="<?php echo $templateUrl; ?>/css/template.ie6.css" type="text/css" media="screen" /><![endif]-->
 <!--[if IE 7]><link rel="stylesheet" href="<?php echo $templateUrl; ?>/css/template.ie7.css" type="text/css" media="screen" /><![endif]-->
 <script type="text/javascript">if ('undefined' != typeof jQuery) document._artxJQueryBackup = jQuery;</script>
 <script type="text/javascript" src="<?php echo $templateUrl; ?>/jquery.js"></script>
 <script type="text/javascript">jQuery.noConflict();</script>
 <script type="text/javascript" src="<?php echo $templateUrl; ?>/script.js"></script>
 <script type="text/javascript">if (document._artxJQueryBackup) jQuery = document._artxJQueryBackup;</script>
</head>
<body>
<div id="art-page-background-middle-texture">
<div id="art-main">
    <div class="cleared reset-box"></div>
<?php if ($view->containsModules('position-1', 'position-28', 'position-29')) : ?>
<div class="art-bar art-nav">
<div class="art-nav-outer">
<div class="art-nav-wrapper">
<div class="art-nav-inner">
<?php if ($view->containsModules('position-28')) : ?>
<div class="art-hmenu-extra1"><?php echo $view->position('position-28'); ?></div>
<?php endif; ?>
<?php if ($view->containsModules('position-29')) : ?>
<div class="art-hmenu-extra2"><?php echo $view->position('position-29'); ?></div>
<?php endif; ?>
<?php echo $view->position('position-1'); ?>
</div>
</div>
</div>
</div>
<div class="cleared reset-box"></div>
<?php endif; ?>
<div class="art-box art-sheet">
    <div class="art-box-body art-sheet-body">
<div class="art-header">
<div class="art-headerobject" onclick="location.href='http://site.com/';" style="cursor: pointer;"></div>
<div class="art-logo">
 <h1 class="art-logo-name"><a href="<?php echo $document->baseurl; ?>/"><?php echo $this->params->get('siteTitle'); ?></a></h1>
 <h2 class="art-logo-text"><?php echo $this->params->get('siteSlogan'); ?></h2>
</div>

</div>
<div class="cleared reset-box"></div>
<?php echo $view->position('position-15', 'art-nostyle'); ?>
<?php echo $view->positions(array('position-16' => 33, 'position-17' => 33, 'position-18' => 34), 'art-block'); ?>
<div class="art-layout-wrapper">
    <div class="art-content-layout">
        <div class="art-content-layout-row">
<?php if ($view->containsModules('position-7', 'position-4', 'position-5')) : ?>
<div class="art-layout-cell art-sidebar1">
<?php echo $view->position('position-7', 'art-block'); ?>
<?php echo $view->position('position-4', 'art-block'); ?>
<?php echo $view->position('position-5', 'art-block'); ?>

  <div class="cleared"></div>
</div>
<?php endif; ?>
<div class="art-layout-cell art-content">

<?php
  echo $view->position('position-19', 'art-nostyle');
  if ($view->containsModules('position-2'))
    echo artxPost($view->position('position-2'));
  echo $view->positions(array('position-20' => 50, 'position-21' => 50), 'art-article');
  echo $view->position('position-12', 'art-nostyle');
  if ($view->hasMessages())
    echo artxPost('<jdoc:include type="message" />');
  echo '<jdoc:include type="component" />';
  echo $view->position('position-22', 'art-nostyle');
  echo $view->positions(array('position-23' => 50, 'position-24' => 50), 'art-article');
  echo $view->position('position-25', 'art-nostyle');
?>

  <div class="cleared"></div>
</div>
<?php if ($view->containsModules('position-6', 'position-8', 'position-3')) : ?>
<div class="art-layout-cell art-sidebar2">
<?php echo $view->position('position-6', 'art-block'); ?>
<?php echo $view->position('position-8', 'art-block'); ?>
<?php echo $view->position('position-3', 'art-block'); ?>

  <div class="cleared"></div>
</div>
<?php endif; ?>

        </div>
    </div>
</div>
<div class="cleared"></div>


<?php echo $view->positions(array('position-9' => 33, 'position-10' => 33, 'position-11' => 34), 'art-block'); ?>
<?php echo $view->position('position-26', 'art-nostyle'); ?>

<div class="cleared"></div>
    </div>
</div>
<div class="art-footer">
    <div class="art-footer-body">
        <div class="art-footer-center">
            <div class="art-footer-wrapper">
                <div class="art-footer-text">
                    <?php echo $view->position('position-14'); ?>
                    <?php if ($view->containsModules('position-27')): ?>
                    <?php echo $view->position('position-27', 'art-nostyle'); ?>
                    <?php else: ?>
                    <?php ob_start(); ?>
<p>Copyright В© 2012. All Rights Reserved.</p>
<div class="cleared"></div>
<p class="art-page-footer"></p>

                    <?php echo str_replace('%YEAR%', date('Y'), ob_get_clean()); ?>
                    <?php endif; ?>
                </div>
            </div>
        </div>
        <div class="cleared"></div>
    </div>
</div>

    <div class="cleared"></div>
</div>
</div>

<?php echo $view->position('debug'); ?>
</body>
</html>
Вот index.php моей темы
*

NortonFox

  • Захожу иногда
  • 441
  • 43 / 0
Re: Вопрос по Title
« Ответ #10 : 15.10.2012, 21:37:47 »
для сео... у меня просто не разбериха какая то получается а то на сайте.
Я так и подумал, что для сео, а можно подробнее, что это даст?
Я знаю только то, что ничего не знаю
*

ereke

  • Осваиваюсь на форуме
  • 22
  • 0 / 0
Re: Вопрос по Title
« Ответ #11 : 11.11.2012, 19:20:37 »
Не буду плодить темы спрошу здесь, эта опция в 1,5 была, а на 2,5 не могу найти.
Нужно что бы в title  на странице материала отображалась название материала и название категории или название сайта.
Например <title>Новость 1 - Категория 1</title>

в \html\com_content\article  пусто, ничего особенного.

Как это сделать?
*

ereke

  • Осваиваюсь на форуме
  • 22
  • 0 / 0
Re: Вопрос по Title
« Ответ #12 : 14.11.2012, 19:19:59 »
Вот код шаблона, как сделать что бы в браузере отображался название материала и название категории?
Скорее всего после get('show_page_heading', 1)) нужно ставить переменную от названия категории? Но как? В PHP вообще не разбираюсь. Пробовал, выскакивает ошибка синтаксиса.
Код
	<?php if ($this->params->get('show_page_heading', 1)) : ?>
<div class="title"><?php echo $this->escape($this->params->get('page_heading')); ?></div>
<?php endif; ?>

<article class="item"<?php if ($view != 'article') printf(' data-permalink="%s"', JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catslug), true, -1)); ?>>

<?php if ($params->get('show_title')) : ?>
<header>
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Вопрос по php

Автор vipex

Ответов: 3
Просмотров: 909
Последний ответ 07.12.2017, 21:31:28
от vipex
Регистрация пользователя - простой вопрос\!

Автор marsklem

Ответов: 8
Просмотров: 1094
Последний ответ 27.11.2017, 12:03:38
от lexxbry
Не изменяется Title главной страницы

Автор Alex_Vazovski

Ответов: 1
Просмотров: 1280
Последний ответ 19.07.2017, 12:51:46
от Alex_Vazovski
Как добавить title в К2?

Автор vipex

Ответов: 0
Просмотров: 864
Последний ответ 30.06.2017, 16:29:26
от vipex
Вопрос по поводу создания на сайте справочника! Прошу помощи от добрых людей!)

Автор taracbulava

Ответов: 2
Просмотров: 1041
Последний ответ 18.08.2016, 12:37:14
от SeBun