小弟試作了一個水平線區分頂置主題的佈景mod,可用於SMF1.0.3的default佈景,提供大家參考。
兩個檔案
package-info.xml 及 puttopline.mod
完成後打包壓縮成 puttopline.zip (不要包含資料夾)
package-info.xml
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is a simplified package manifest for SMF packages.
ATTENTION: If you are trying to install this manually, you should try
the package manager. If it will not work for you, please take a look
at the following for information on this format:
http://mods.simplemachines.org/docs/manual-install.php
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>test:PutTopLine</id>
<name>水平線區分頂置主題</name>
<type>modification</type>
<version>1.0</version>
<install>
<readme type="inline">水平線區分頂置主題
注意: 若以下檔案及資料夾為可寫入,此模組將能正確地安裝! 安裝前請將以下檔案設定適當權限及備份.
1. 修改 ./Themes/default/MessageIndex.template.php
</readme>
<modification type="file" format="boardmod">puttopline.mod</modification>
</install>
<uninstall>
<readme type="inline">這將移除--水平線區分頂置主題--這個模組
</readme>
<modification type="file" format="boardmod" reverse="true">puttopline.mod</modification>
</uninstall>
</package-info>
puttopline.mod
<id>
test:PutTopLine
</id>
<version>
1.0
</version>
<mod info>
水平線區分頂置主題
</mod info>
<author>
test
</author>
<homepage>
http://www.mysite.com
</homepage>
<edit file>
$themedir/MessageIndex.template.php
</edit file>
<search>
foreach ($context['topics'] as $topic)
{
</search>
<add after>
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr class="titlebg" style="font-size: 1ex;">
<td colspan="2"></td>
<td colspan="7" height="8"></td>
</tr>';
$previousTopicClass = $topic['class'];
</add after>