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.

How to replace a forum tag to an html tag?

4 posters

Go down

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
congdantoancau
congdantoancau
Forumember

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

http://learn.forumvi.com

Back to top Go down

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:
Niko
Niko
Helper
Helper

Male Posts : 3285
Reputation : 254
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

Back to top Go down

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.
congdantoancau
congdantoancau
Forumember

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

http://learn.forumvi.com

Back to top Go down

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51554
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

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);
});
});
Niko
Niko
Helper
Helper

Male Posts : 3285
Reputation : 254
Language : English, Italian, French
Location : Italy

https://www.fmcodes.net/

SarkZKalie, TonnyKamper and congdantoancau like this post

Back to top Go down

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
congdantoancau
congdantoancau
Forumember

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

http://learn.forumvi.com

Niko likes this post

Back to top Go down

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.
skouliki
skouliki
Manager
Manager

Female Posts : 15391
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Back to top

- Similar topics

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