1. Laurence Brevard
  2. Wishlist
  3. Friday, 14 February 2014
  4.  Subscribe via email
When there are multiple notes on a page, the newest is at the bottom.
How can I reverse this order so the newest is on top?
Accepted Answer Pending Moderation
0
Votes
Undo
Ordering of your notes can be accomplished by changing the file mod_cnotes/helper.php .
Change lines 23-25 from
$query->select('*')->from('#__cnotes_notes')
->where('created_by = ' . $db->quote($user->id))
->where('url = ' . $db->quote(self::getUrl()));

to
$query->select('*')->from('#__cnotes_notes')
->where('created_by = ' . $db->quote($user->id))
->where('url = ' . $db->quote(self::getUrl()))
->order('id DESC');


Only drawback: the new ordering only will be visible after a 'hard' page refresh, so not immediately after adding a new note.

Regards
Gerlof
  1. more than a month ago
  2. Wishlist
  3. # 1
Accepted Answer Pending Moderation
0
Votes
Undo
Thanks for the pointer.
I had already done the equivalent by traversing the list using [color=#bb0000]array_reverse[/color] when writing the on-page notes list.
This has the same behavior as changing the query, including that a new note is not at the top until revisiting the page.
in .../modules/mod_cnotes/tmpl/default.php

...
<div class="cnotes-notes">
<?php if (count($items)) : ?>
<?php $items = array_reverse( $items ); ?>
<?php foreach ($items as $item) : ?>
<div>
<span class="title">
<a href="/<?php echo JRoute::_('index.php?option=com_cnotes&task=note.edit&id=' . $item->id); ?>">
<?php echo $item->title; ?>
</a>
</span>
<?php echo $item->note; ?>
</div>
<?php endforeach; ?>
<?php else : ?>
<span class="cnotes-nothing">
<?php echo JText::_('MOD_CNOTES_NO_NOTES'); ?>
</span>
<?php endif; ?>
</div>
...


I have made several other changes including a bug fix on the page that writes out all your notes:
components/com_cnotes/views/notes/tmpl/default.php

On that page, I removed an extra ">" that was showing up as a list of one ">" per note and I did some better column headings.

I know this is a free module that was done in a class. Is there a way to submit changes to it?
  1. more than a month ago
  2. Wishlist
  3. # 2
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Last questions

Unable to order comment if imported
Hi Support, on CComment 6.0.9 (the same for previous release), importing commen...
0 Replies
Posted on Sunday, 09 August 2020
  • New
    • #bug, import id, order comments
    Hotspots frontend submissions form has severe prob
    I've been using hotspots maps for many years...6 or 7...and now I find that the ...
    0 Replies
    Posted on Friday, 07 August 2020
  • New
  • error after update hotspot pro
    Hi after update hotspot pro ger error on spot page Warning: count(): P...
    2 Replies
    Posted on Thursday, 06 August 2020
  • New
  • Update Matukio auf 7.0.18
    Hallo, ich versuche, Matukio von Version 7.0.17 auf Version 7.0.18 zu aktualisi...
    2 Replies
    Posted on Tuesday, 04 August 2020
  • New
  • Doppelte Buchungen im Backend aufgetaucht
    Hallo Yves, ich verwende noch Joomla 3.9.5 und Matukio 7.0.15 aktuell komm...
    3 Replies
    Posted on Tuesday, 28 July 2020