FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 12 users online :: 0 Registered, 0 Hidden and 12 Guests

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

[SOLVED] Different Logo For Specific sub-forums

View previous topic View next topic Go down

Forumedic
Forumedic

Gender : Unspecified
Posts : 130
Points : 3087
Reputation : 14
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.forumpromocean.com

PostForumedic Sun 10 Jul 2016, 13:36

I know it's possible and involves JavaScript, I was wondering if I could please have some help?

Ange's old post for portal: http://help.forumotion.com/t134043-different-logo-for-the-portal

So rather than portal, I'd like to choose a specific forum/sub-forum for the different logo. I have a couple sub-forums/forums that I'd like to change the logo for.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Sun 10 Jul 2016, 15:26

Hey,

Install the script below in the following places :

1. sub-forums
2. topics ( optional )
Code:
$(function() {
  var image = {
    1 : 'new_logo',
    2 : 'new_logo',
    3 : 'new_logo',
    4 : 'new_logo'
  },

  forum = $('.pathname-box:first a:last')[0],
  logo = document.getElementById('logo').firstChild,
  i;

  if (forum) {
    forum = +forum.href.replace(/.*?f(\d+).*/, '$1');

    for (i in image) {
      if (i == forum) {
        logo.src = image[i]
      }
    }
  }

  'par ange tuteur';
});

After this, just edit the object at the top named "image."

To the left you should see a number, that is the forum id.
To the right you should see "new_logo" that's where you'll place the logo for that forum.

So it's easier to remember :
Code:
  var image = {
    forum_id : 'new_logo',
    forum_id : 'new_logo',
    forum_id : 'new_logo',
    forum_id : 'new_logo'
  },
Make sure you place a comma at the end of each pair, EXCEPT for the last pair.

If any problems let me know.
Forumedic
Forumedic

Gender : Unspecified
Posts : 130
Points : 3087
Reputation : 14
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.forumpromocean.com

PostForumedic Mon 11 Jul 2016, 12:42

Thanks!

It's not working for me, here is what I added:
Code:
$(function() {
  var image = {
    16 : 'http://i1320.photobucket.com/albums/u537/MayaGrayx3/Apparel%20designs/g11621-2-3-4.png',
    34 : 'http://i1320.photobucket.com/albums/u537/MayaGrayx3/Apparel%20designs/g11621-2-3-4.png'
  },
 
  forum = $('.pathname-box:first a:last')[0],
  logo = document.getElementById('logo').firstChild,
  i;
 
  if (forum) {
    forum = +forum.href.replace(/.*?f(\d+).*/, '$1');
 
    for (i in image) {
      if (i == forum) {
        logo.src = image[i]
      }
    }
  }
 
  'par ange tuteur';
});
Anonymous
Guest
Guest

PostGuest Mon 11 Jul 2016, 13:05

Forumedic wrote:Thanks!

It's not working for me, here is what I added:
Code:
$(function() {
  var image = {
    16 : 'http://i1320.photobucket.com/albums/u537/MayaGrayx3/Apparel%20designs/g11621-2-3-4.png',
    34 : 'http://i1320.photobucket.com/albums/u537/MayaGrayx3/Apparel%20designs/g11621-2-3-4.png'
  },
 
  forum = $('.pathname-box:first a:last')[0],
  logo = document.getElementById('logo').firstChild,
  i;
 
  if (forum) {
    forum = +forum.href.replace(/.*?f(\d+).*/, '$1');
 
    for (i in image) {
      if (i == forum) {
        logo.src = image[i]
      }
    }
  }
 
  'par ange tuteur';
});

LOL! Like @Ange Tuteur said, you still gotta learn a great deal,,,,, Laughing

Razz @ the 'par ange tuteur' @Ange Tuteur! lol!
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Mon 11 Jul 2016, 13:22

Looks like a mistake on my part, I didn't notice that the class of the breadcrumbs changed in subforums. Try replace your script with this and see if it works for you now :
Code:
$(function() {
  var image = {
    16 : 'http://i1320.photobucket.com/albums/u537/MayaGrayx3/Apparel%20designs/g11621-2-3-4.png',
    34 : 'http://i1320.photobucket.com/albums/u537/MayaGrayx3/Apparel%20designs/g11621-2-3-4.png'
  },
 
  forum = $('.pathname-box:first a:last, .path:first a:last')[0],
  logo = document.getElementById('logo').firstChild;
 
  if (forum) {
    forum = +forum.href.replace(/.*?f(\d+).*/, '$1');
   
    if (image[forum]) {
      logo.src = image[forum];
    }
  }
 
  'par ange tuteur';
});


@Samantha no one can truly learn without first making mistakes.. Wink

PS
I mark certain snippets of code in case someone decides to take it and make a tutorial about it without my permission. I've seen it happen in the past with codes I posted on the help forum. Toothless
Anonymous
Guest
Guest

PostGuest Mon 11 Jul 2016, 13:29

Ange Tuteur wrote:Looks like a mistake on my part, I didn't notice that the class of the breadcrumbs changed in subforums. Try replace your script with this and see if it works for you now :
Code:
$(function() {
  var image = {
    16 : 'http://i1320.photobucket.com/albums/u537/MayaGrayx3/Apparel%20designs/g11621-2-3-4.png',
    34 : 'http://i1320.photobucket.com/albums/u537/MayaGrayx3/Apparel%20designs/g11621-2-3-4.png'
  },
 
  forum = $('.pathname-box:first a:last, .path:first a:last')[0],
  logo = document.getElementById('logo').firstChild;
 
  if (forum) {
    forum = +forum.href.replace(/.*?f(\d+).*/, '$1');
   
    if (image[forum]) {
      logo.src = image[forum];
    }
  }
 
  'par ange tuteur';
});


@Samantha no one can truly learn without first making mistakes.. Wink

PS
I mark certain snippets of code in case someone decides to take it and make a tutorial about it without my permission. I've seen it happen in the past with codes I posted on the help forum. Toothless

About the PS part. Are you accusing me? Because if I ever did, you know how I feel about my codes getting stolen. I had a huge fight over my codes, a 'certain dude' on here and my profile pic last year and that's why I'm reluctant to show any no more yk. I feel I did nothing wrong here, but if I did just don't hold back telling me. I know the feel. Regarding your code here right now, I'm sorry, but it feels like it's all too easy to ask you for codes and do nothing in return yk. Wink It all ends with me copycatting, grabbing, taking. yk me.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Mon 11 Jul 2016, 13:37

No, "someone" is denoting any random lurker on the internet who is viewing my posts. I wont name names, but I wasn't talking about you, however I'm sure the people who repost my content know I'm talking about them. Wink
Anonymous
Guest
Guest

PostGuest Mon 11 Jul 2016, 13:38

Ange Tuteur wrote:No, "someone" is denoting any random lurker on the internet who is viewing my posts. I wont name names, but I wasn't talking about you, however I'm sure the people who repost my content know I'm talking about them. Wink

:/ Hmm.. I hate lurkers. Hence the security on my site. I love you you! (blocking 'm in fact if it was on here Laughing). You should protect your codes, tbh, @Ange Tuteur. They're precious!


So SHHHH silly lurkers GO AWAY!
Forumedic
Forumedic

Gender : Unspecified
Posts : 130
Points : 3087
Reputation : 14
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.forumpromocean.com

PostForumedic Mon 11 Jul 2016, 15:54

Solved, thanks Ange.

I have one quick question, is it possible to make it faster? It could be that I have bad WiFi and I'm using iPad but when I go on the page (sub-forum or topic) I can see the original banner for a few seconds.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Mon 11 Jul 2016, 16:49

No, not really. The script must wait for the document ( or target element ) to be ready before it knows which forum you're in. So there's always going to be a small delay for the banner to change since the target element comes after the banner.

If you're only targeting the sub-forums and not topics in the sub-forums you could use the window location which would be a wee bit faster. Are you applying this to the topics as well, or only the sub-forums ? If it's only the sub-forums I could speed up the execution of the script.
Forumedic
Forumedic

Gender : Unspecified
Posts : 130
Points : 3087
Reputation : 14
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://www.forumpromocean.com

PostForumedic Mon 11 Jul 2016, 17:13

I'm doing both topics and sub-forums.

The code is great, thanks for the help! Smile I don't think a delay will be too big of a deal.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12044
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Mon 11 Jul 2016, 19:41

In that case you might want to stick with the last code. However, if you do want it a little faster I can use another method. Just let me know. Salute

Anyway, you're welcome. Smile
Sponsored content

PostSponsored content

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

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