-
AuthorPosts
-
matgray87 Friend
matgray87
- Join date:
- November 2011
- Posts:
- 159
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 33
- Thanked:
- 8 times in 1 posts
October 7, 2014 at 9:45 pm #201897Hi,
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,
MattTomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
October 7, 2014 at 9:53 pm #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 Friendmatgray87
- Join date:
- November 2011
- Posts:
- 159
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 33
- Thanked:
- 8 times in 1 posts
Eragon H FriendEragon H
- Join date:
- July 2014
- Posts:
- 468
- Downloads:
- 1
- Uploads:
- 39
- Thanks:
- 5
- Thanked:
- 156 times in 149 posts
October 8, 2014 at 2:17 am #552195Hi 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 Friendmatgray87
- Join date:
- November 2011
- Posts:
- 159
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 33
- Thanked:
- 8 times in 1 posts
October 8, 2014 at 9:42 am #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!
Mattmatgray87 Friendmatgray87
- Join date:
- November 2011
- Posts:
- 159
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 33
- Thanked:
- 8 times in 1 posts
October 8, 2014 at 9:54 am #552247I 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 Friendmatgray87
- Join date:
- November 2011
- Posts:
- 159
- Downloads:
- 0
- Uploads:
- 17
- Thanks:
- 33
- Thanked:
- 8 times in 1 posts
October 8, 2014 at 10:49 am #552258Worked 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>
1 user says Thank You to matgray87 for this useful post
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
October 8, 2014 at 4:37 pm #552309Glad 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. 😎
-
AuthorPosts
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