Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace dt element with jQuery (phpBB)

Tags:

jquery

phpbb

I tried searching, but all the examples and answers I found I couldn't 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'm trying to relace this part (the entire 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 the entire jquery code I need to make this work please? Thank you.

like image 691
Kailey Truscott Avatar asked Nov 08 '22 04:11

Kailey Truscott


1 Answers

phpBB only forbides modifying core php files. If you want to modify data, you have to use extension. But you aren't in this case.

For template, it is recommanded to use Event Template extension especially when you have to add some new features. But you can alter your template, especially on your case !

Here is the good practice :

Create a new style heriting prosilver

# 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's name
# if this style does not have a parent style
parent = prosilver

Copy/paste the template file viewforum.phtml, you wanna alter in your new style directories and alter it directly.

phpBB/styles/mystyle/template/viewforum_body.html

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

Here is a good documentation about template Inheritance

like image 100
Alexandre Tranchant Avatar answered Dec 14 '22 19:12

Alexandre Tranchant