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.

BBcode/html in rpg profile

View previous topic View next topic Go down

BBcode/html in rpg profile

Post by Farronsister on April 20th 2016, 11:08 am

Hello,

I noticed that you can't use BBcode/html in the textfields of the RPG profile. Is there a way to make this possible anyhow?

Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

Re: BBcode/html in rpg profile

Post by Genesis on April 20th 2016, 3:44 pm

Text zones will allow the BBCode.

Genesis
Forum Reviewer
Forum Reviewer

Male Posts : 2331
Reputation : 322
Language : English
Location : Forumountain

http://forumpromocean.com

Back to top Go down

Re: BBcode/html in rpg profile

Post by Farronsister on April 20th 2016, 7:05 pm

On the normal profile, yes, but not with the RPG profile. (Admin panel => Modules => Roleplay Game).

Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

Re: BBcode/html in rpg profile

Post by Genesis on April 20th 2016, 7:53 pm

That's because you can't add a text zone in the role-play game. So I am not sure if this is possible.

Genesis
Forum Reviewer
Forum Reviewer

Male Posts : 2331
Reputation : 322
Language : English
Location : Forumountain

http://forumpromocean.com

Back to top Go down

Re: BBcode/html in rpg profile

Post by Farronsister on April 20th 2016, 11:53 pm

Maybe there's a way to enable BBcode in rpg fields with javascript? Unfortunately Im not good with that. Html and css I can do fine, but javascript no, so I wouldnt know what to look for.

Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

Re: BBcode/html in rpg profile

Post by Genesis on April 21st 2016, 2:57 am

If I may ask what BBCode would you use?

Genesis
Forum Reviewer
Forum Reviewer

Male Posts : 2331
Reputation : 322
Language : English
Location : Forumountain

http://forumpromocean.com

Back to top Go down

Re: BBcode/html in rpg profile

Post by Farronsister on April 21st 2016, 7:47 am

I want members to be able to add pictures, make the text bold/italic etc. Basically the same as what you can do with normal profile fields.

Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

Re: BBcode/html in rpg profile

Post by Genesis on April 21st 2016, 6:02 pm

Try Text/List, it looks the same as a Text Zone.

Genesis
Forum Reviewer
Forum Reviewer

Male Posts : 2331
Reputation : 322
Language : English
Location : Forumountain

http://forumpromocean.com

Back to top Go down

Re: BBcode/html in rpg profile

Post by Farronsister on April 21st 2016, 9:10 pm

That doesn't work. Sad

Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

Re: BBcode/html in rpg profile

Post by Ange Tuteur on April 23rd 2016, 12:05 am

@Farronsister It should be possible to parse the bbcode client-side with JavaScript however, I need a little more information :

1. A link to the page where your RPG field is ( or a link to a topic if the field is in the topics )
2. What field specifically do you want bbcode to work in ?
3. What tag(s) do you want parsed ? ( e.g. [b], [i], [img], etc.. )

Thanks in advance for providing the info above. salut

Ange Tuteur
Forumaster

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

http://fmdesign.forumotion.com

Back to top Go down

Re: BBcode/html in rpg profile

Post by Farronsister on April 23rd 2016, 12:18 am

Someone has found the solution for me! Thanks for your help anyway! Smile

Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

Re: BBcode/html in rpg profile

Post by Genesis on April 23rd 2016, 1:01 am

What was the solution if I may ask?

Genesis
Forum Reviewer
Forum Reviewer

Male Posts : 2331
Reputation : 322
Language : English
Location : Forumountain

http://forumpromocean.com

Back to top Go down

Re: BBcode/html in rpg profile

Post by Farronsister on April 23rd 2016, 8:58 am

I'm not sure if I'm allowed to copy the code, but he used JavaScript to turn the fields into a div that allows BBcode (like Ange Tuteur suggested)

Farronsister
New Member

Posts : 14
Reputation : 1
Language : Dutch/English

http://www.warriorcatsnl.com/

Back to top Go down

Re: BBcode/html in rpg profile

Post by 10spetter10 on April 24th 2016, 11:18 am

I have no problem with sharing the code. Perhaps it could help others with the same problem.

Code:
$(function() {
    var pathname = $(location).attr('pathname');
        if (pathname.match("^/u") ) {
          $("textarea").each(function(index, value) {
            var obj = jQuery(value);
            var tmp = obj.val().replace(/[\r\n]/g, "<br />");

            $format_search =  [
                /\[b\](.*?)\[\/b\]/ig,
                /\[i\](.*?)\[\/i\]/ig,
                /\[u\](.*?)\[\/u\]/ig,
                /\[img\](.*?)\[\/img\]/ig
            ];
           
            $format_replace = [
                '<strong>$1</strong>',
                '<em>$1</em>',
                '<span style="text-decoration: underline;">$1</span>',
                '<img class="rpgtext_img" src="$1" />'
            ];
           
            for (var i =0;i<$format_search.length;i++) {
              var tmp = tmp.replace($format_search[i], $format_replace[i]);
            }

            var newTag = jQuery("<div></div>").html(tmp);
            newTag.addClass("rpg_text");
            obj.replaceWith(newTag);

        });
    }
});

There are maybe better scripts but this will do.

10spetter10
Forumember

Posts : 195
Reputation : 81
Language : Dutch

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