Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • simondooner Friend
    #171746

    I 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 Moderator
    #429406

    Are you saying that you want the logo to change with each different page your users visit?

    simondooner Friend
    #429460

    Hi 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 Moderator
    #429536

    Can 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 Friend
    #429542

    I 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 Moderator
    #429850

    Are you referring to the little “tool tip” that pops-up when the mouse hovers over the logo – which currently has “Bodybuilder Ltd” now?

    simondooner Friend
    #429933

    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.

    Thanks

    TomC Moderator
    #430010

    To 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 Moderator
    #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 Friend
    #430251

    Hi Tom

    Thanks, yes the on page article title is delivered from the template file –
    templates/ja_travel/html/com_content/article/default.php

    Using 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.

Viewing 10 posts - 1 through 10 (of 10 total)

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