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.

Topic Prefix:

View previous topic View next topic Go down

Solved Topic Prefix:

Post by Mati on September 15th 2015, 12:06 pm

I search but I didn't find what I'm looking for so here is an image of what I mean.

My forum is PhpBB3



Last edited by Mati on September 21st 2015, 11:11 pm; edited 1 time in total

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Topic Prefix:

Post by SLGray on September 15th 2015, 8:46 pm



When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35661
Reputation : 2375
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

Solved Re: Topic Prefix:

Post by Mati on September 15th 2015, 9:51 pm

I looked at that and nearly the same but I want to add classes for each value as it looks below.

[Rules]
[Solved]
[Accepted]

Ex: like this with drop-dawn the prefix to show next to topictitle.
Code:
<span class="prefix" style="background:#FF9C47;">Rules</span>
<span class="prefix" style="background:#FF9C47;">Solved</span>
<span class="prefix" style="background:#42B4E6;">Accepted</span>

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Topic Prefix:

Post by Mati on September 17th 2015, 9:13 am

Really need this any one knows how...

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Topic Prefix:

Post by Niko on September 18th 2015, 6:32 pm


Niko
Hyperactive

Male Posts : 2166
Reputation : 93
Language : English, French, Italian, Spanish, Latin

https://www.translationscloud.com/?utm_source=forumotion&utm

Back to top Go down

Solved Re: Topic Prefix:

Post by Mati on September 19th 2015, 10:12 am


I have seen that Niko, and I don't want the prefix to show at "Modify topic title" but in Title of the topic as it shows in the image.

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Topic Prefix:

Post by Mati on September 21st 2015, 8:43 am

BUMP Wink

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Topic Prefix:

Post by Ange Tuteur on September 21st 2015, 11:50 am

Hi @Mati,

Would this tutorial be similar to what you're looking for ?
http://help.forumotion.com/t133869-style-topic-title-keywords

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Topic Prefix:

Post by Mati on September 21st 2015, 12:01 pm

Hi @Ange Tuteur

I have seen and used that before but is not what I'm looking for. I want members to use it too like they can choose from the drop-dawn list.

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Topic Prefix:

Post by Hagoromo Otsutsuki on September 21st 2015, 12:41 pm

This seams nice.

Hagoromo Otsutsuki
Forumember

Male Posts : 514
Reputation : 21
Language : English
Location : Heaven

http://naruto-omniverse.forumotion.com/

Back to top Go down

Solved Re: Topic Prefix:

Post by Ange Tuteur on September 21st 2015, 1:29 pm

For the drop down you can use the following.
Modules > JavaScript codes management > New

Placement : In all the pages
Code:
$(function() {
  // prefixes
  // syntax : 'PREFIX_NAME' : 'ADDITIONAL_ATTRIBUTES'
  var prefix = {
    'Prefix 1' : '',
    'Prefix 2' : '',
    'Prefix 3' : ''
  };

  // check for form and subject existence
  if (document.post && document.post.subject) {
    var select = document.createElement('SELECT'), // create the dropdown
        i;
       
    select.innerHTML = '<option value="none">None</option>'; // default value

    // value change function
    select.onchange = function() {
      var subject = document.post.subject,
          child = this.childNodes,
          i = 0,
          j = child.length,
          opts = '',
          reg;

      if (subject) {
        // setup prefix regex
        for (; i < j; i++) opts += child[i].value + '|';
        reg = RegExp('^(?:' + opts.replace(/[.*+?^${}()[\]\\]/g, "\\$&") + ') ');

        // check and replace prefixes if necessary
        if (reg.test(subject.value)) subject.value = subject.value.replace(reg, this.value == 'none' ? '' : this.value + ' ');
        else subject.value = (this.value == 'none' ? '' : this.value + ' ') + subject.value;
      }
    };

    // put together options
    for (i in prefix) select.innerHTML += '<option value="[' + i + ']" ' + prefix[i] + '>[' + i + ']</option>';
    document.post.subject.parentNode.appendChild(select); // add selection to form body
  }
});
// par ange tuteur

At the top you can define your prefixes + additional attributes in the empty string I left, such as style="(CSS_STRINGS...)", class="(CLASS_STRINGS...)", etc..
Code:
  var prefix = {
    'Prefix 1' : '',
    'Prefix 2' : '',
    'Prefix 3' : ''
  };

Just to be clear, to the left of the colon is the prefix name, and to the right is a string for additional attributes if you want to add any. As for the design of the prefixes once posted, the last tutorial I posted should cover that. Wink

If any questions let me know. Smile

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Topic Prefix:

Post by Mati on September 21st 2015, 1:42 pm

That works but how to add classes for each prefix for example
Code:
<div class="prefix1">Prefix 1</div>
<div class="prefix2">Prefix 2</div>
<div class="prefix3">Prefix 3</div>


Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Topic Prefix:

Post by Ange Tuteur on September 21st 2015, 2:12 pm

For after submission you would use this tutorial :
http://help.forumotion.com/t133869-style-topic-title-keywords

For the options in the select drop down you can add the class in the attributes string. For example :
Code:
  var prefix = {
    'Prefix 1' : 'class="prefix_1"',
    'Prefix 2' : 'class="prefix_2"',
    'Prefix 3' : 'class="prefix_3"'
  };

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Topic Prefix:

Post by Mati on September 21st 2015, 2:31 pm

I did that and only change the color on the select drop down, but I wanna change prefix that shows before topictitle if that's possible.

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Topic Prefix:

Post by Ange Tuteur on September 21st 2015, 3:52 pm

In the input area for the subject, correct ? As far as I know that wouldn't be possible since you can't style specific texts in an input field. Unless of course you were to create a faux-input field where HTML formats.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Topic Prefix:

Post by Mati on September 21st 2015, 10:43 pm

Is okay you can look it now Smile

Mati
Active Poster

Posts : 1873
Reputation : 281
Language : || HTML || CSS || jQuery ||
Location : At the Gym

http://elite-gaming.forumotion.net/

Back to top Go down

Solved Re: Topic Prefix:

Post by SLGray on September 22nd 2015, 3:16 am

Topic solved and archived


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35661
Reputation : 2375
Language : English
Location : United States

http://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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