Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • matgray87 Friend
    #201897

    Hi,
    Is it possible to have the Masshead title change dynamically as per the page heading.
    My example being, as a new user is created in K2, on their blog page, I’d like the title in the masshead to pick up the name of the user in their blog page…
    Cheers,
    Matt

    TomC Moderator
    #552169

    <em>@matgray87 449083 wrote:</em><blockquote>Hi,
    Is it possible to have the Masshead title change dynamically as per the page heading.
    My example being, as a new user is created in K2, on their blog page, I’d like the title in the masshead to pick up the name of the user in their blog page…
    Cheers,
    Matt</blockquote>

    I’m thinking that is going to take some custom PHP programming work . . . most likely outside the scope of basic technical support here. Nevertheless, I’ll be interested to see what others may have to say about such an idea.

    matgray87 Friend
    #552171

    @tomc

    It’s done on the article pages in JA Decor… the title automatically appears in the masshead… how does that work?
    Thanks

    Eragon H Friend
    #552195

    Hi Mat,

    Currently this function is not available in Ja Masshead. And as Tom C mentioned in previous post, this is outside the scope of basic technical support here.

    However, you can refer this article for your need: http://www.joomlart.com/forums/topic/user-name-in-jamasshead/

    matgray87 Friend
    #552246

    @eragon H

    Thanks… that’s a useful start, and that’s good for showing the username in the masshead of a logged in user, but what I really want to do is to pull in the K2 title for a user blog, so not logged in…

    So to start with, i’ve got this:

    <?php if ($input->getCmd ('option') == 'com_k2' && $input->getVar ('view') == 'itemlist' && $input->getVar ('layout') == 'user') :

    so it’ll only pull in the title on the right set of pages, but I can’t for the life of me work out how to pull the page title.

    I tried
    <?php echo ($item->params->get('page_title')); ?>
    but it doesn’t recognise the current $item.

    Thanks again!
    Matt

    matgray87 Friend
    #552247

    I can get the user ID to show in the masshead with the following, but can’t then get the name to display instead of the ID:

    <div class="jamasshead<?php echo $params->get('moduleclass_sfx','')?>">
    <h3 class="jamasshead-title"><?php echo $article->get("title"); ?></h3>
    </div>

    <?php elseif ($input->getCmd ('option') == 'com_k2' && $input->getVar ('view') == 'itemlist' && $input->getVar ('task') == 'user') :

    $user = JFactory::getUser();

    $K2Itemid = JRequest::getInt('id');

    ?>
    <div class="jamasshead<?php echo $params->get('moduleclass_sfx','')?>">
    <h3 class="jamasshead-title"><?php echo $K2Itemid; ?></h3>
    </div>

    matgray87 Friend
    #552258

    Worked it out now… thanks for your help…

    <?php $input = JFactory::getApplication()->input; ?>

    <?php if ($input->getCmd ('option') == 'com_k2' && $input->getVar ('view') == 'itemlist' && $input->getVar ('task') == 'user') :

    $K2Itemid = JRequest::getInt('id');

    $db = JFactory::getDBO();
    $db->setQuery("SELECT userName FROM #__k2_users WHERE userID = ".$K2Itemid );
    $username = $db->loadResult();

    ?>
    <div class="jamasshead<?php echo $params->get('moduleclass_sfx','')?>">
    <h3 class="jamasshead-title"><?php echo $username; ?></h3>
    </div>

    TomC Moderator
    #552309

    Glad to hear you worked it out … and GREAT JOB !!!

    I’m going to mark this thread as a TIP – n case others might want to try something similar. 😎

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

This topic contains 8 replies, has 3 voices, and was last updated by  TomC 10 years, 1 month ago.

We moved to new unified forum. Please post all new support queries in our New Forum