DLE hacks
Expanding the functionality of the template engine
26-12-2022, 14:35
Actually, I got tired of writing tags with my hands every time
and decided to add them to the BB panel, so that when the text is selected and the button is pressed, the selected piece is wrapped in
a tag
We go to engine/classes/parse.class.php
We find:
if ($count_start AND $count_start == $count_end) $source = str_ireplace( "", "<b>", str_ireplace( "", "</b>", $source ) );
Below we put:
$count_start = substr_count ($source, "");
$count_end = substr_count ($source, "
");
if ($count_start AND $count_start == $count_end) $source = str_ireplace( "", "<H2>", str_ireplace( "
", "</H2>", $source ) );
$count_start = substr_count ($source, "");
$count_end = substr_count ($source, "
");
if ($count_start AND $count_start == $count_end) $source = str_ireplace( "", "<H3>", str_ireplace( "
", "</H3>", $source ) );
$count_start = substr_count ($source, "");
$count_end = substr_count ($source, "
");
if ($count_start AND $count_start == $count_end) $source = str_ireplace( "", "<H4>", str_ireplace( "
", "</H4>", $source ) );
In the engine/modules/bbcode file.php find:
<b id="b_ol" class="bb-btn" onclick="tag_list('ol')" title="{$lang['bb_t_list2']}">{$lang['bb_t_list2']}</b>
<span class="bb-sep">|</span>
And below we put:
<div id="b_h2" class="editor_button" onclick="simpletag('H2')">H2</div>
<span class="bb-sep">|</span>
<div id="b_h3" class="editor_button" onclick="simpletag('H3')">H3</div>
<span class="bb-sep">|</span>
<div id="b_h4" class="editor_button" onclick="simpletag('H4')">H4</div>
Next we go to engine/ajax/bbcode.php
We find:
<b id="b_ol" class="bb-btn" onclick="tag_list('ol')" title="$lang[bb_t_list2]">$lang[bb_t_list2]</b>
<span class="bb-sep">|</span>
And below the rate:
<div id="b_h2" class="editor_button" onclick="simpletag('H2')">H2</div>
<span class="bb-sep">|</span>
<div id="b_h3" class="editor_button" onclick="simpletag('H3')">H3</div>
<span class="bb-sep">|</span>
<div id="b_h4" class="editor_button" onclick="simpletag('H4')">H4</div>
To connect the codes in the admin panel, you need to go to engine/inc/include/inserttag.php
To find:
<div id="b_ol" class="editor_button" onclick="tag_list('ol')"><img title="$lang[bb_t_list2]" src="engine/skins/bbcodes/images/ol.gif" width="23" height="25"></div>
<div class="editor_button"><img src="engine/skins/bbcodes/images/brkspace.gif" width="5" height="25"></div>
Insert below:
<div id="b_h2" class="editor_button" onclick="simpletag('H2')">H2</div>
<div class="editor_button"><img src="engine/skins/bbcodes/images/brkspace.gif" width="5" height="25"></div>
<div id="b_h3" class="editor_button" onclick="simpletag('H3')">H3</div>
<div class="editor_button"><img src="engine/skins/bbcodes/images/brkspace.gif" width="5" height="25"></div>
<div id="b_h4" class="editor_button" onclick="simpletag('H4')">H4</div>
Now in any connected to the site .insert the css file
#b_h2 {
cursor: pointer;
width: 23px;
float: left;
margin: 3px 0px 0px 5px;
}
#b_h3 {
cursor: pointer;
width: 23px;
float: left;
margin: 3px 0px 0px 5px;
}
#b_h4 {
cursor: pointer;
width: 23px;
float: left;
margin: 3px 0px 0px 5px;
}
26-12-2022, 14:35
26-12-2022, 12:26
26-12-2022, 13:49
There are no comments
Information
Users of Visitor are not allowed to comment this publication.