SOLVED | Last edited txt <> link ?

General questions about CMSimple
twc
Posts: 233
Joined: Fri Jun 18, 2010 12:25 am
Location: Netherlands

SOLVED | Last edited txt <> link ?

Post by twc » Tue Jan 22, 2013 3:44 pm

normaly you see at the pag last edited > date.

Is this possible ?
Letts say you have many pages and you update one and at the front page you wanna see the last edited page.

its it possible ? through link to the last selected editing page
Last edited by twc on Tue Jan 22, 2013 10:31 pm, edited 1 time in total.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Last edited txt <> link ?

Post by cmb » Tue Jan 22, 2013 5:59 pm

Hi twc,

you can store the following as index.php of a new folder under plugins/:

Code: Select all

<?php

function latestUpdatedPageLink()
{
    global $h, $pd_router;

    $pd = $pd_router->find_all();
    $t = 0;
    foreach ($pd as $i => $data) {
        if ($data['last_edit'] > $t) {
            $t = $data['last_edit'];
            $n = $i;
        }
    }
    return a($n, '') . $h[$n] . '</a>';
}

?>
The you can add to the template:

Code: Select all

<p>Latest updated page: <?php echo latestUpdatedPageLink();?></p>
Christoph
Christoph M. Becker – Plugins for CMSimple_XH

twc
Posts: 233
Joined: Fri Jun 18, 2010 12:25 am
Location: Netherlands

Re: Last edited txt <> link ?

Post by twc » Tue Jan 22, 2013 8:11 pm

thanks.......

i dont undrstand this :?

you can store the following as index.php of a new folder under plugins/:

svasti
Posts: 1651
Joined: Wed Dec 17, 2008 5:08 pm

Re: Last edited txt <> link ?

Post by svasti » Tue Jan 22, 2013 8:31 pm

twc wrote:you can store the following as index.php of a new folder under plugins/:
just put Christophs code into a file, name the file index.php, create a new folder with any name under the plugins folder and put your new index.php into that folder.

twc
Posts: 233
Joined: Fri Jun 18, 2010 12:25 am
Location: Netherlands

Re: Last edited txt <> link ?

Post by twc » Tue Jan 22, 2013 9:00 pm

svasti wrote:
twc wrote:you can store the following as index.php of a new folder under plugins/:
just put Christophs code into a file, name the file index.php, create a new folder with any name under the plugins folder and put your new index.php into that folder.
uhm, dont working to bad :cry:

index.php > folder > latestUpdate > drop in main dir

template.htm

Code: Select all

<?php echo latestUpdatedPageLink();?>

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Last edited txt <> link ?

Post by cmb » Tue Jan 22, 2013 9:24 pm

Hi twc,

I'm not sure if you have "installed" it correctly, so remove what you have and put the code into the file plugins/lastedited/index.php. It should work, even if I'm not sure, that it's the solution you were looking for.

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

twc
Posts: 233
Joined: Fri Jun 18, 2010 12:25 am
Location: Netherlands

Re: Last edited txt <> link ?

Post by twc » Tue Jan 22, 2013 9:32 pm

cmb wrote:Hi twc,

I'm not sure if you have "installed" it correctly, so remove what you have and put the code into the file plugins/lastedited/index.php. It should work, even if I'm not sure, that it's the solution you were looking for.

Christoph
Cannot modify header information - headers already sent (output started at /mounted-storage/home121a/sub001/sc28987-VHAG/xxxxxxxx/xxxxxxxxxx/plugins/lastedited/index.php:1)

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Last edited txt <> link ?

Post by cmb » Tue Jan 22, 2013 10:15 pm

I assume you have some characters before the starting <? or the file is encoded as UTF-8 with BOM.

Please try lastedited. Install as usual for plugins (i.e. in plugins/).
Christoph M. Becker – Plugins for CMSimple_XH

twc
Posts: 233
Joined: Fri Jun 18, 2010 12:25 am
Location: Netherlands

Re: Last edited txt <> link ?

Post by twc » Tue Jan 22, 2013 10:33 pm

cmb wrote:I assume you have some characters before the starting <? or the file is encoded as UTF-8 with BOM.

Please try lastedited. Install as usual for plugins (i.e. in plugins/).
YOUR THE MAN :D

working great, i think thise must be @ next release +100000000000000

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: SOLVED | Last edited txt <> link ?

Post by cmb » Tue Jan 22, 2013 11:02 pm

I'm glad that it works and that it's what you were looking for. :)

I've put it on the roadmap: http://cmsimpleforum.com/viewtopic.php?f=29&t=5661
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply