How to replace a forum tag to an html tag? Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
4 posters

    How to replace a forum tag to an html tag?

    congdantoancau
    congdantoancau
    Forumember


    Male Posts : 77
    Reputation : 4
    Language : Vietnamese
    Location : Vietnam

    In progress How to replace a forum tag to an html tag?

    Post by congdantoancau August 1st 2022, 5:16 am

    hello
    I want to replace [size=48]text[/size] to <h1>text</h1> and the same as [size=32]text[/size] to <h2>text</h2> in the .post-entry.
    How can I do that? Please help me!
    Thanks in advanced!

    p/s: I adready known how to insert a script to Javascript codes management module but don't know how to code a script to replace them
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3231
    Reputation : 248
    Language : English, Italian, French
    Location : Italy

    In progress Re: How to replace a forum tag to an html tag?

    Post by Niko August 7th 2022, 11:36 pm

    Dear @congdantoancau

    do you want this to be effective on topics view, right? It's something with effect after the topic has been published, is it?

    :rose:
    congdantoancau
    congdantoancau
    Forumember


    Male Posts : 77
    Reputation : 4
    Language : Vietnamese
    Location : Vietnam

    In progress Re: How to replace a forum tag to an html tag?

    Post by congdantoancau August 8th 2022, 2:06 am

    Niko wrote:Dear @congdantoancau

    do you want this to be effective on topics view, right? It's something with effect after the topic has been published, is it?

    :rose:

    Yes, I want to affect it when the topics is loaded.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51498
    Reputation : 3523
    Language : English
    Location : United States

    In progress Re: How to replace a forum tag to an html tag?

    Post by SLGray August 8th 2022, 2:42 am

    Are you talking about this?
    How to replace a forum tag to an html tag? H210



    How to replace a forum tag to an html tag? Slgray10

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


    Male Posts : 3231
    Reputation : 248
    Language : English, Italian, French
    Location : Italy

    In progress Re: How to replace a forum tag to an html tag?

    Post by Niko August 8th 2022, 2:01 pm

    [quote="congdantoancau"]
    Niko wrote:Yes, I want to affect it when the topics is loaded.

    and sorry @congdantoancau, forgot to ask, is you forum version Invision, right ?

    edit: if so, give a try with this javascript code:

    Code:
    $(function() {   
        $('.post-entry div').each(
        function(){
            var content = $(this).html().replace(/\[size=32\]/g,'<h2>').replace(/\[size=48\]/g,'<h1>').replace(/\[\/size\]/g,'</h2>');
            $(this).html(content);
    });
    });

    SarkZKalie, TonnyKamper and congdantoancau like this post

    congdantoancau
    congdantoancau
    Forumember


    Male Posts : 77
    Reputation : 4
    Language : Vietnamese
    Location : Vietnam

    In progress Re: How to replace a forum tag to an html tag?

    Post by congdantoancau August 11th 2022, 3:00 am

    [quote="Niko"]
    congdantoancau wrote:
    Niko wrote:Yes, I want to affect it when the topics is loaded.

    and sorry @congdantoancau, forgot to ask, is you forum version Invision, right ?

    edit: if so, give a try with this javascript code:

    Code:
    $(function() {   
        $('.post-entry div').each(
        function(){
            var content = $(this).html().replace(/\[size=32\]/g,'<h2>').replace(/\[size=48\]/g,'<h1>').replace(/\[\/size\]/g,'</h2>');
            $(this).html(content);
    });
    });

    Thanks you very much! It works. I didn't thought that was so simple before. Think it might need to use REGEX or something

    Niko likes this post

    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15311
    Reputation : 1705
    Language : English,Greek
    Location : Greece

    In progress Re: How to replace a forum tag to an html tag?

    Post by skouliki August 11th 2022, 9:48 pm

    When your request is complete, please mark it as Solved.