The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

New Message Coding

Page 2 of 2 Previous  1, 2

View previous topic View next topic Go down

In progress New Message Coding

Post by Legolover-361 on October 1st 2011, 1:07 am

First topic message reminder :

Hello, all.

I'm working on a new skin for the Bionicle: Next Generation message board (don't complain about its appearance -- it's still a work-in-progress). I've added a new, custom menu (also still a work-in-progress), but I don't know how to code the "Messages" text to change when the user has one or more new messages.

The type of menu isn't important, as I already know where to place the new coding. I'd just like to know what that coding is.

Help would be greatly appreciated.

Legolover-361
Forumember

Male Posts : 40
Reputation : -1
Language : English, XHTML, CSS

Back to top Go down


In progress Re: New Message Coding

Post by LGforum on October 5th 2011, 5:29 pm

I'd recommend changing the script above to this.

Code:

$(function(){
var pm_text = $('a.mainmenu[href="/privmsg?folder=inbox"]').text();
if(pm_text){
  $('ul#nav a[href="/privmsg"] span').html(pm_text);
}
});


LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

In progress Re: New Message Coding

Post by ankillien on October 5th 2011, 6:40 pm

@LGforum wrote:I'd recommend changing the script above to this.

Code:

$(function(){
var pm_text = $('a.mainmenu[href="/privmsg?folder=inbox"]').text();
if(pm_text){
  $('ul#nav a[href="/privmsg"] span').html(pm_text);
}
});


Yes, but it will show the traditional and ugly 'You have no new messages' text.

ankillien
Energetic

Posts : 5198
Reputation : 129
Language : English, XHTML, CSS, JS, PHP, SQL

http://www.webartzforum.com/

Back to top Go down

In progress Re: New Message Coding

Post by Legolover-361 on October 5th 2011, 7:28 pm

I wouldn't mind the "traditional and ugly" You have no new messages text as long as the text changes whenever someone has a new message; the problem is, the coding doesn't work. =/

Legolover-361
Forumember

Male Posts : 40
Reputation : -1
Language : English, XHTML, CSS

Back to top Go down

In progress Re: New Message Coding

Post by LGforum on October 6th 2011, 2:56 am

Try this:

[code]
$(function(){
var pm_text = $('a[href$="/privmsg?folder=inbox"]').text();
if(pm_text){
$('ul#nav a[href="/privmsg"] span').html(pm_text);
}
});

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

In progress Re: New Message Coding

Post by Legolover-361 on October 6th 2011, 4:01 pm

That still didn't change the text.

Legolover-361
Forumember

Male Posts : 40
Reputation : -1
Language : English, XHTML, CSS

Back to top Go down

In progress Re: New Message Coding

Post by LGforum on October 7th 2011, 12:32 am

Code:

$(function(){
var pm_text = $('a.mainmenu[href="/privmsg?folder=inbox"]').text();
if(pm_text){
  x=$('#shop').get();
  y=$(x).find('span')[0];
  y.innerHTML=pm_text;
}
});

What about this...

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

In progress Re: New Message Coding

Post by Legolover-361 on October 7th 2011, 3:04 am

I appreciate your efforts, but again the code isn't working. I should start looking into jQuery, I suppose, to figure out what's wrong myself.

Legolover-361
Forumember

Male Posts : 40
Reputation : -1
Language : English, XHTML, CSS

Back to top Go down

Page 2 of 2 Previous  1, 2

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum