• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Znote Acc, TFS 1.3 Changelog

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,175
Solutions
17
Reaction score
481
Location
Sweden
Hello,
Can't find any updated post for this but my changelog ain't working while updating news.
Config.php
LUA:
// Enable or disable changelog ticker in news page.
    $config['UseChangelogTicker'] = true;
index.php
LUA:
<?php
if ($config['UseChangelogTicker']) {
    //////////////////////
    // Changelog ticker //
    // Load from cache
    $changelogCache = new Cache('engine/cache/changelog');
    $changelogs = $changelogCache->load();

    if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
        ?>
        <table id="changelogTable">
            <tr class="yellow">
                <td colspan="2">Latest Changelog Updates (<a href="changelog.php" style="color: darkorange;">Click here to see full changelog</a>)</td>
            </tr>
            <?php
            for ($i = 0; $i < count($changelogs) && $i < 5; $i++) {
                ?>
                <tr>
                    <td><?php echo getClock($changelogs[$i]['time'], true, true); ?></td>
                    <td><?php echo $changelogs[$i]['text']; ?></td>
                </tr>
                <?php
            }
            ?>
        </table>
        <?php
    } else echo "No changelogs submitted.";
}
$cache = new Cache('engine/cache/news');
if ($cache->hasExpired()) {
    $news = fetchAllNews();

    $cache->setContent($news);
    $cache->save();
} else {
    $news = $cache->load();
}

// Design and present the list
if ($news) {
    function TransformToBBCode($string) {
        $tags = array(
            '
[CENTER]{$1}[/CENTER]
' => '<center>$1</center>',
            '[B]{$1}[/B]' => '<b>$1</b>',
            '[size={$1}]{$2}[/size]' => '<font size="$1">$2</font>',
            '[IMG]http://{$1}[/IMG]'    => '<a href="$1" target="_BLANK"><img src="$1" alt="image" style="width: 100%"></a>',
            '[link]{$1}[/link]'    => '<a href="$1">$1</a>',
            '[link={$1}]{$2}[/link]'   => '<a href="$1" target="_BLANK">$2</a>',
            '[color={$1}]{$2}[/color]' => '<font color="$1">$2</font>',
            '[*]{$1}[/*]' => '<li>$1</li>',
        );

        foreach ($tags as $tag => $value) {
            $code = preg_replace('/placeholder([0-9]+)/', '(.*?)', preg_quote(preg_replace('/\{\$([0-9]+)\}/', 'placeholder$1', $tag), '/'));
            $string = preg_replace('/'.$code.'/i', $value, $string);
        }

        return $string;
    }
    foreach ($news as $n) {
        ?>

        <div class="panel panel-default">
            <div class="panel-heading"><?php echo getClock($n['date'], true); ?> | <?php echo TransformToBBCode($n['title']); ?> Published by <?php echo '<a href="characterprofile.php?name='. $n['name'] .'">'. $n['name'] .'</a>'; ?>.</div>
            <div class="panel-body">
                <?php echo TransformToBBCode(nl2br($n['text'])); ?>
            </div>
      </div>
        <?php
    }
}
?>
9e3faa5114442b2905fca5512e90b8d4.gif

Result:
0302d45dd1d80e9525670d53dab84547.png

Screenshot - 0302d45dd1d80e9525670d53dab84547 - Gyazo (https://gyazo.com/0302d45dd1d80e9525670d53dab84547)
 
Last edited:
Solution
Make sure engine/cache/changelog.cache.php file exist and has write permission.

I think changelog.php fails to write and load from cache. The list only loads from cache, which is only being built upon create/update/delete actions.
Make sure engine/cache/changelog.cache.php file exist and has write permission.

I think changelog.php fails to write and load from cache. The list only loads from cache, which is only being built upon create/update/delete actions.
 
Solution
Make sure engine/cache/changelog.cache.php file exist and has write permission.

I think changelog.php fails to write and load from cache. The list only loads from cache, which is only being built upon create/update/delete actions.
How do you change the look of it?
In the file everything is in one line, for example,
here is changelog #221012+421+04 12+04124o921+0 changelog is working fine24091412iwopioqwr...
LUA:
[{"id":"4","text":"Test Log#1\r\nTest YAOOOO","time":"1547917188","report_id":"0","status":"35"},{"id":"3","text":"Test2\r\nTake 2\r\nShieeet, jesus.. help me man ","time":"1547006427","report_id":"0","status":"35"},{"id":"2","text":"Test\r\nChangelog #1\r\n...\r\n","time":"1547006402","report_id":"0","status":"35"}]
 
Back
Top