-
AuthorPosts
-
simondooner Friend
simondooner
- Join date:
- October 2008
- Posts:
- 9
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 1 times in 1 posts
December 12, 2011 at 9:13 pm #171746I hope someone can help.
I am trying to dynamically change the template logo title from “site name” to “page name” but can not seem to get it to function correctly. I have done this successfully in Joomla 1.5, but am now working with JA_Travel in Joomla 1.7.
I have edited the following file:
templates/ja_travel/blocks/header.php
Original template code:
[PHP]<?php
$app = & JFactory::getApplication();
$siteName = $app->getCfg(‘sitename’);
if ($this->getParam(‘logoType’, ‘image’)==’image’): ?>
<h1 class=”logo”>
<a href=”index.php” title=”<?php echo $siteName; ?>”><span><?php echo $siteName; ?></span></a>
</h1>
<?php else:
$logoText = (trim($this->getParam(‘logoText’))==”) ? $siteName : JText::_(trim($this->getParam(‘logoText’)));
$sloganText = JText::_(trim($this->getParam(‘sloganText’))); ?>
<div class=”logo-text”>
<h1><a href=”index.php” title=”<?php echo $siteName; ?>”><span><?php echo $logoText; ?></span></a></h1>
<p class=”site-slogan”><?php echo $sloganText;?></p>
</div>
<?php endif; ?><?php if($this->countModules(‘slogan’)) : ?>
<div id=”ja-slogan”>
<jdoc:include type=”modules” name=”slogan” />
</div>
<?php endif; ?>[/PHP]Code changed using $appTitle = $document->getTitle();
[PHP]<?php
jimport( ‘joomla.document.document’ );
$document =& JFactory::getDocument();
$appTitle = $document->getTitle();
$siteName = $this->sitename();
if ($this->getParam(‘logoType’)==’image’): ?>
<h1 class=”logo”>
<a href=”index.php” title=”<?php echo $appTitle; ?>”><span><?php echo $appTitle; ?></span></a>
</h1>
<?php else:
$logoText = (trim($this->getParam(‘logoType-text-logoText’))==”) ? $config->sitename : $this->getParam(‘logoType-text-logoText’);
$sloganText = (trim($this->getParam(‘logoType-text-sloganText’))==”) ? JText::_(‘SITE SLOGAN’) : $this->getParam(‘logoType-text-sloganText’);?>
<div class=”logo-text”>
<h1><a href=”index.php” title=”<?php echo $appTitle; ?>”><span><?php echo $appTitle; ?></span></a></h1>
<p class=”site-slogan”><?php echo $sloganText;?></p>
</div>
<?php endif; ?>
[/PHP]The output shows
<h1 class=”logo”>
<a href=”/joomla_dev/” title=””><span></span></a></h1>
Any suggestions would be appreciated.
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
December 12, 2011 at 11:13 pm #429406Are you saying that you want the logo to change with each different page your users visit?
simondooner Friendsimondooner
- Join date:
- October 2008
- Posts:
- 9
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 1 times in 1 posts
December 13, 2011 at 10:07 am #429460Hi Tom
Thanks. No, the site logo image remains constant across the whole site.
I want to dynamically change the “title” of the logo from the site name (title=”<?php echo $siteName; ?>) to the page name.
The second batch of code included in my first message has been posted previously on the forum as a solution to this problem for a Joomla 1.5 based template. Unfortunately, I can not get it to work on a J 1.7 based template.
Hope this helps to clarify.
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
December 13, 2011 at 10:43 pm #429536Can you provide the url of the site you’re working on – just so I can take a look at the live example of this issue?
simondooner Friendsimondooner
- Join date:
- October 2008
- Posts:
- 9
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 1 times in 1 posts
December 13, 2011 at 11:13 pm #429542I have sent the access details to you via PM.
The logo title code on the site has been changed back to the template original so the title will show the site name.
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
December 16, 2011 at 1:13 am #429850Are you referring to the little “tool tip” that pops-up when the mouse hovers over the logo – which currently has “Bodybuilder Ltd” now?
simondooner Friendsimondooner
- Join date:
- October 2008
- Posts:
- 9
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 1 times in 1 posts
December 16, 2011 at 9:03 am #429933Yes, I believe it’s generated by… title=”<?php echo $siteName; ?>”.
I would like to substitute the <?php echo $siteName; ?> for the Page Title, which will be specific to each page.
Thanks
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
December 16, 2011 at 6:06 pm #430010To be honest, this is the first time I’ve seen an idea like this . . . I’ll further research the issue and get back to you a.s.a.p.
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
December 18, 2011 at 12:34 am #430125<em>@simondooner 289527 wrote:</em><blockquote>Yes, I believe it’s generated by… title=”<?php echo $siteName; ?>”.
I would like to substitute the <?php echo $siteName; ?> for the Page Title, which will be specific to each page.
</blockquote>
In Global Configuration – under SEO Settings – you can choose to have the site name before or after the page title, or hide it altogether. Give that a try.
simondooner Friendsimondooner
- Join date:
- October 2008
- Posts:
- 9
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 1 times in 1 posts
December 18, 2011 at 3:59 pm #430251Hi Tom
Thanks, yes the on page article title is delivered from the template file –
templates/ja_travel/html/com_content/article/default.phpUsing the code:
[PHP]<?php if ($params->get(‘show_title’)) : ?>
<h1>
<?php if ($params->get(‘link_titles’) && !empty($this->item->readmore_link)) : ?>
<a href=”<?php echo $this->item->readmore_link; ?>”>
<?php echo $this->escape($this->item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>
<?php if ($canEdit) : ?>
<span class=”edit-icon”>
<?php echo JHtml::_(‘icon.edit’, $this->item, $params); ?>
</span>
<?php endif; ?>
</h1>
[/PHP]I would like to use the article title in the same way but insert it in place of the site name in the template file – templates/ja_travel/blocks/header.php
Original code
[PHP]<?php
$app = & JFactory::getApplication();
$siteName = $app->getCfg(‘sitename’);
if ($this->getParam(‘logoType’, ‘image’)==’image’): ?><h1 class=”logo”>
<a href=”index.php” title=”<?php echo $siteName; ?>”><span><?php echo $siteName; ?></span></a>
</h1>
[/PHP]From the above I would like to do the following…
<a href=”index.php” title=”ARTICLE TITLE”><span><ARTICLE TITLE></span></a>
Sorry, I don’t know how to achieve this.
-
AuthorPosts
This topic contains 10 replies, has 2 voices, and was last updated by simondooner 12 years, 10 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum