We moved to new unified forum!

Please post all new support queries in our New Forum.

T3 Community Discussion & Support

Let's build the best free Joomla template framework, together!
  1. Richard
  2. General Discussion
  3. Monday, 08 February 2016
  4.  Subscribe via email
Hi

I'm building a new template using t3 bs3 blank and have most areas set-up, but one is really baffling me. In the design the article title has been placed in the header area, just beneath the menu, separate from the article text.

The header uses a background image so ideally I need to get the article title code into the header file but cannot work out how to get it to display. I've been playing around with the file plugins > system > t3 > base bs3 > html > layouts > joomla > content > item_title.php...

<header class="article-header clearfix">
<<?php echo $title_tag; ?> class="article-title" itemprop="name">
<?php if ($params->get('link_titles')) : ?>
<a href="<?php echo $url ?>" itemprop="url" title="<?php echo $this->escape($item->title); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<meta itemprop="url" content="<?php echo $prefix.$url ?>" />
<?php endif; ?>
</<?php echo $title_tag; ?>>

<?php if ($item->state == 0) : ?>
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php if (strtotime($item->publish_up) > strtotime(JFactory::getDate())) : ?>
<span class="label label-warning"><?php echo JText::_('JNOTPUBLISHEDYET'); ?></span>
<?php endif; ?>
<?php if ((strtotime($item->publish_down) < strtotime(JFactory::getDate())) && $item->publish_down != '0000-00-00 00:00:00') : ?>
<span class="label label-warning"><?php echo JText::_('JEXPIRED'); ?></span>
<?php endif; ?>
</header>

I've tried copying this entire block to header.php, as well as sections of it but cannot get it to display.

Does anyone have a similar override they have successfully completed or any ideas how to get this to work?

Any help is much appreciated!

Thanks
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
it is normal that the title of the article is the title of the page.
if you're working so use this:

Use this code in your header.php

<?php
$title = JFactory::getDocument()->getTitle();
echo '<h1>'.$title.'</h1>';
?>
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 1
Accepted Answer Pending Moderation
0
Votes
Undo
Thank you for your help Alvaro, the code output the menu (page) title but i was after the actual article title. But you put me on the right track and I eventually came across this code which works perfectly...

<?php
$input = JFactory::getApplication()->input;
$id = $input->getInt('id');
$article = JTable::getInstance('content');
$article->load($id);
echo '<h1>' . $article->get('title') . '</h1>';
?>

Thank you again
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 2
Accepted Answer Pending Moderation
0
Votes
Undo
Thanks @Alvaro for great tips.

Regards.
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.