If the index of the page is known, say stored in $index, you can use $pd_router->find_page($index)['last_update'] to get the last update date of the page.
Last changes
Moderator: Tata
Re: Last changes
Christoph M. Becker – Plugins for CMSimple_XH
Re: Last changes
I tried to add into the index.php
and
The result is:
1. Start - 01.01.1970
2. Templates - 01.01.1970
In the content.htm, there is e.g.
So I assume that in the $html = ... shall the very exact 10-digits value be inserted from $page_data array.
Code: Select all
...
$pageData = $pd_router->find_all();
$index = $pd_router->find_page($index)['last_edit']; /***/
uasort($pageData, function ($a, $b) {
return $b['last_edit'] - $a['last_edit'];
});...
Code: Select all
foreach ($pages as $page) {
$html .= '<li><a href="' . "$sn?$u[$page]" . '">' . $h[$page] . ' - '.$index.'</a></li>';
1. Start - 01.01.1970
2. Templates - 01.01.1970
In the content.htm, there is e.g.
Code: Select all
<html><head><title>Content file</title>
<?php
...
'last_edit'=>'1322055182',
...
<!--XH_ml1:Start-->
<?php
$page_data[]=array(
'url'=>'Start',
'last_edit'=>'1613328024',
...
<!--XH_ml1:Templates-->
<?php
$page_data[]=array(
'url'=>'Templates',
'last_edit'=>'1613120230',
...
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Last changes
I've made the changes in the index file: now it looks like this
there is a strike added but no date
www.beremooiehymers.nl
Code: Select all
Laatste wijzigingen
Colofon -
Minigids -
Inhoud Minigids -
Hymer S -
www.beremooiehymers.nl
Rob Zeijen,
Valkenswaard (NL)
Valkenswaard (NL)
Re: Last changes
for the userfuncs.php
Result is like here. Top right, the info icon. Is called with
https://olaf.penschke.net/
Code: Select all
/**
* @copyright 2016 Christoph M. Becker
* @copyright 2016 (for some additions) by svasti
* 2018 small modifications by olape
* @license GPLv3
*/
/*
{{{recently_changed()}}}, {{{recently_changed(10)}}}, {{{PLUGIN:recently_changed(10,24);}}}, {{{PLUGIN:recently_changed('',24);}}}
oder im Template:
<?php echo recently_changed()?>, <?php echo recently_changed(10)?>, <?php echo recently_changed(10,24)?>, <?php echo recently_changed('',24)?>
*/
function recently_changed($count = 5, $length = 28)
{
global $pd_router, $cf;
$pageData = $pd_router->find_all();
uasort($pageData, function ($a, $b) {
return $b['last_edit'] - $a['last_edit'];
});
$pages = array();
$i = 0;
foreach (array_keys($pageData) as $page) {
if ($i < $count) {
if (!hide($page)) {
$timestamp = $pageData[$page]['last_edit'];
//$date = XH_formatDate($timestamp); // date('Y-m-d', $timestamp);
$date = date('d.m.Y', $timestamp);
$pages[$date][] = $page;
$i++;
}
} else {
break;
}
}
global $sn, $h, $u;
$html = '<dl class="recently_changed">';
foreach ($pages as $date => $group) {
$html .= '<dt>' . $date . '</dt>';
foreach ($group as $page) {
$linktext = str_replace($cf['uri']['seperator'], ' ', $u[$page]);
$linktext_length = utf8_strlen($linktext);
if($linktext_length > $length) {
$linktext = utf8_substr($linktext, -$length);
$stringpos = utf8_strpos($linktext, ' ');
$linktext = utf8_substr($linktext, (-$length + $stringpos));
}
$html .= '<dd><a href="' . "$sn?$u[$page]" . '">- ' . $linktext . '</a></dd>';
}
}
$html .= '</dl>';
return $html;
}
Code: Select all
{{{recently_changed('7', '28')}}}
Gruß Olaf, Plugins for CMSimple_XH
Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.
Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.