Replace dt element with jQuery (phpBB)

I tried the search, but all the examples and answers that I found, I could not get to work.

phpBB has the following lines of code:

<!-- IF topicrow.S_FIRST_ROW or not topicrow.S_TOPIC_TYPE_SWITCH --> <div class="forumbg<!-- IF topicrow.S_TOPIC_TYPE_SWITCH and (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) --> announcement<!-- ENDIF -->"> <div class="inner"> <ul class="topiclist"> <li class="header"> <dl class="row-item"> <dt<!-- IF S_DISPLAY_ACTIVE --> id="active_topics"<!-- ENDIF -->><div class="list-inner"><!-- IF S_DISPLAY_ACTIVE -->{L_ACTIVE_TOPICS}<!-- ELSEIF topicrow.S_TOPIC_TYPE_SWITCH and (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) -->{L_ANNOUNCEMENTS}<!-- ELSE -->{L_TOPICS}<!-- ENDIF --></div></dt> <dd class="posts">{L_REPLIES}</dd> <dd class="views">{L_VIEWS}</dd> <dd class="lastpost"><span>{L_LAST_POST}</span></dd> </dl> </li> </ul> 

I am trying to pass this part (the whole line)

 <dt<!-- IF S_DISPLAY_ACTIVE --> id="active_topics"<!-- ENDIF -->> <div class="list-inner"> <!-- IF S_DISPLAY_ACTIVE -->{L_ACTIVE_TOPICS} <!-- ELSEIF topicrow.S_TOPIC_TYPE_SWITCH and (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) -->{L_ANNOUNCEMENTS} <!-- ELSE -->{L_TOPICS}<!-- ENDIF --> </div> </dt> 

For reference, I need to change it to

 <dt<!-- IF S_DISPLAY_ACTIVE --> id="active_topics"<!-- ENDIF -->> <div class="list-inner"> <!-- IF S_DISPLAY_ACTIVE -->{L_ACTIVE_TOPICS} <!-- ELSEIF topicrow.S_TOPIC_TYPE eq 3 -->{L_GLOBAL_ANNOUNCEMENTS} <!-- ELSEIF (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) eq 2 -->{L_ANNOUNCEMENTS} <!-- ELSEIF topicrow.S_TOPIC_TYPE eq 1 -->{L_STICKY} <!-- ELSE -->{L_TOPICS}<!-- ENDIF --> </div> </dt> 

Can someone provide all the jquery code that I need to get the job done? Thanks.

+5
source share
1 answer

phpBB forbids modification of the main php files. If you want to change the data, you need to use the extension. But you are not in this case.

For the template, it is recommended to use the Template Template extension, especially when you need to add some new features. But you can change your template, especially in your case!

Here is a good practice:

Create a new spotlight to create a style

 # General Information about youstyle name = mystyle copyright = © phpBB Limited, 2016 style_version = 3.1.10 phpbb_version = 3.1.10 # Defining a different template bitfield # template_bitfield = lNg= # Parent style # Set value to empty or to this style name # if this style does not have a parent style parent = prosilver 

Copy / paste the viewforum.phtml template file , you want to change it in your new style directories and change it directly.

 phpBB/styles/mystyle/template/viewforum_body.html 

Use the admin panel to check your modification. When this is done, change the default template from prosilver to mystyle

Here is a good documentation on Inheritance Template

+1
source

Source: https://habr.com/ru/post/1261189/


All Articles