By Neel on Saturday, 08 November 2014
Posted in General Issues
Replies 13
Likes 0
Views 541
Votes 0
I am having the notification modules in all pages. When there is a new notification, how can I show the notification counts in the meta title of all pages so it shows the browser tabs? (Similar to what stackoverflow does). Is there a php code I can add directly to the template's index.php to show the count if new notification exists? What's the easy way to do this?

Right now it shows in the ES pages but it goes away when I go to other pages.
that would be a little more complex then in one page.
However the process isn't that much complex.... I would change the document.title to that some kind of notification and push it in php with a addScript declaration to the page. However we need to reupdate when taken etc...

This would be a nice feature that isn't there right now Maybe push a voice request, I'm not sure the guys would (had time to) do something right now.
·
Saturday, 08 November 2014 05:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Alexandre Cayer, thanks for chipping in.

I was thinking it may be possible by using the feature of the Notification module itself which already checks for new notifications every x seconds. When the notification module is included in all pages, perhaps the notification counter can be prepended directly to the title via jquery? If it cant manipulate the title directly, we can maybe add a placeholder using php into the template file that jquery can add to when the notification modules counter changes.

I feel this is a basic yet important feature. I always find this extremely useful with FB and SO site which does this especially when we have multiple tabs open.
·
Saturday, 08 November 2014 05:29
·
0 Likes
·
0 Votes
·
0 Comments
·
I just noticed that it does show the counter in title on other pages too when you have the notification module enabled. However, the counter goes away when you go to another page and it takes a while before the counter gets added to the title again (probably based on the checks in secs). Would be perfect if I can prepend it to the title instead of append (the way it is now) so its not hidden on long titles.
·
Saturday, 08 November 2014 06:03
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

Currently it is not possible but we will see if we can include this in the future.

The module itself doesn't modify the page title, hence on page load, the notification number is not added.

Due to the module using the same scripts to periodically check for new notification, the unread count is then added through javascript.
·
Saturday, 08 November 2014 12:20
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jason, with the current behaviour when the javascript adds the unread count after page load, how can I make this unread count to show at the beginning of the title instead of the end?
·
Saturday, 08 November 2014 16:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Neel,

Currently these are done on the js end and unfortunately you can't customize it. If you really need to, you need to edit the file /media/com_easysocial/scripts/site/toolbar/system.js

After making the changes, you need to recompile the javascripts by accessing the site via http://yoursite.com/index.php?option=com_easysocial&compile=true&minify=true

I am really sorry but unfortunately we would not be able to provide support for this.
·
Sunday, 09 November 2014 21:51
·
0 Likes
·
0 Votes
·
0 Comments
·
Ouchhh, hardest hack yet lol create a voice so you can bug Mark with it later
·
Monday, 10 November 2014 11:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark, I understand that these are done by the js. But shouldn't it be possible for you guys to show the counter to appear at the beginning of the title rather than at the end? As such the js is already adding the counter to the title. Only minor adjustments needed will be to pretend it. Just that should be good enough for now atleast. This way the title counter is not hidden in pages with longer titles else it beats it's purpose.
·
Monday, 10 November 2014 14:53
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

As mentioned by Mark, you need to edit the file /media/com_easysocial/scripts/site/toolbar/system.js

After making the changes, you need to recompile the javascripts by accessing the site via http://yoursite.com/index.php?option=com_easysocial&compile=true&minify=true

We will see if we can add a switch to this in the future.
·
Monday, 10 November 2014 15:17
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes I read that and my question is couldnt you include this to prepend yourself for ES? And hence this post:
Neel wrote:

Hi Mark, I understand that these are done by the js. But shouldn't it be possible for you guys to show the counter to appear at the beginning of the title rather than at the end? As such the js is already adding the counter to the title. Only minor adjustments needed will be to pretend it. Just that should be good enough for now atleast. This way the title counter is not hidden in pages with longer titles else it beats it's purpose.
·
Monday, 10 November 2014 15:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

We will see if we can include this in the future.

Because this involves a switch, javascript changes, and also carrying PHP configuration values into javascript, it is not as simple as it looks.
·
Monday, 10 November 2014 15:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Its not as easy as this (see below)? Assuming that the notification module already does what it does and stores the unread count to a var, shouldnt adding something like this injects this count to the title?

$doc = JFactory::getDocument(); 
$page_title = $doc->getTitle();
doc->setTitle($NotificationCount.' - '.$page_title);


or JS
var title = $(this).attr('title');
$('title').val(NotificationCount+page_title);


This is what I thought would need to be done and didnt see any additional need for carrying php values to js, etc.. just to inject this count. Maybe I am wrong on my assumption..
·
Monday, 10 November 2014 15:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi,

This is if everyone wants the notification count to be at the start of the title.
·
Monday, 10 November 2014 15:51
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post