REQUEST v4 Notification Display Order ?

blackestflag

Well-known member
Joined
Oct 19, 2022
Messages
491
Awards
4
Offline
Does anyone know if it's possible to change the display order in Notifications
I would like to see if it's possible to have the most recent at the top

I had a poke around but didn't see anything obvious.
Not sure if this is an APK or Panel modification that needs to be

Any tips/help is greatly appreciated

1708788956260.png
 

Villain4U

Well-known member
Joined
Oct 16, 2023
Messages
41
Awards
3
Offline
Does anyone know if it's possible to change the display order in Notifications
I would like to see if it's possible to have the most recent at the top

I had a poke around but didn't see anything obvious.
Not sure if this is an APK or Panel modification that needs to be

Any tips/help is greatly appreciated

View attachment 8960
Better to do it from panel
 

abelcustoms

Well-known member
Joined
Jun 29, 2021
Messages
210
Awards
3
Offline
Change the ID it will display them the exact order the api gives it. The latest one will be displayed first
 

blackestflag

Well-known member
Joined
Oct 19, 2022
Messages
491
Awards
4
Offline
Change the ID it will display them the exact order the api gives it. The latest one will be displayed first
Thanks for the insight Abel, although I'm still lost.
Where would I find the ID ? Are you saying to manually change the ID number in the db ?
Or is there a piece of code in the APP, or the panel that dictates the order ID ?
 

nowacx

Well-known member
Joined
May 28, 2021
Messages
339
Awards
4
Offline
Thanks for the insight Abel, although I'm still lost.
Where would I find the ID ? Are you saying to manually change the ID number in the db ?
Or is there a piece of code in the APP, or the panel that dictates the order ID ?
yes, manually changing in db is a way to do it

here's something you can try, see if it works for you.....
assuming you're using the typical/similar .db ftg/rtx panels like those posted by @JEMUMAN , add the below edit_note.php file to your panel root folder that also holds note.php (not the one in api)

smarters displays messages in the order of lowest 'index' message at the top and highest 'index' at the bottom, so when you open/run edit_note.php in your browser it'll show the 'index' of all your messages n you can change them to suit your need

rename edit_note.php to your choosing

 

blackestflag

Well-known member
Joined
Oct 19, 2022
Messages
491
Awards
4
Offline
yes, manually changing in db is a way to do it

here's something you can try, see if it works for you.....
assuming you're using the typical/similar .db ftg/rtx panels like those posted by @JEMUMAN , add the below edit_note.php file to your panel root folder that also holds note.php (not the one in api)

smarters displays messages in the order of lowest 'index' message at the top and highest 'index' at the bottom, so when you open/run edit_note.php in your browser it'll show the 'index' of all your messages n you can change them to suit your need

rename edit_note.php to your choosing

*** Hidden text: cannot be quoted. ***
You sir, are a super star, and I appreciate the help
Although it's a bit of a pain to have to manually re-order the ID's, it's quick and dirty and get's the job done

As complicated (and convoluted) Smarters' apps are.. you think there would be a piece of code (or in Smarters case; 20 pieces) inside the APK where we could simply change ascending to descending, or vice versa

Regardless, it's working as intended, thank you again @nowacx
 

WorldsElite

HELP WHEN I CAN
Joined
Jun 4, 2021
Messages
176
Awards
3
Offline
Assuming your using the generic FTG V4 panel that's everywhere you can modify the api/note.php to the following.

PHP:
<?php
error_reporting(0);
$db = new SQLite3('./.db.db');
$note = $db->query('SELECT * FROM note ORDER BY ID DESC');

while ($notes = $note->fetchArray(SQLITE3_ASSOC)) {
    $data[] = ['Title' => $notes['Title'], 'Description' => $notes['Description'], 'CreateDate' => $notes['CreateDate']];
}

$jdata = json_encode($data);
echo '{"status":true,' . "\r\n\t\t" . '"response":' . "\r\n\t\t" . $jdata . "\r\n\t\t" . '}';

?>

This will show in descending order if there ID in the database
 

blackestflag

Well-known member
Joined
Oct 19, 2022
Messages
491
Awards
4
Offline
Assuming your using the generic FTG V4 panel that's everywhere you can modify the api/note.php to the following.

PHP:
<?php
error_reporting(0);
$db = new SQLite3('./.db.db');
$note = $db->query('SELECT * FROM note ORDER BY ID DESC');

while ($notes = $note->fetchArray(SQLITE3_ASSOC)) {
    $data[] = ['Title' => $notes['Title'], 'Description' => $notes['Description'], 'CreateDate' => $notes['CreateDate']];
}

$jdata = json_encode($data);
echo '{"status":true,' . "\r\n\t\t" . '"response":' . "\r\n\t\t" . $jdata . "\r\n\t\t" . '}';

?>

This will show in descending order if there ID in the database
Yes, using the FTG v4 based panel, I did try adding "ORDER BY ID DESC, and it didn't work for me
Cleared cache, etc still no dice. Not changing order on panel, nor within the APK

Although, I thought it would be something simple, turns out it's not

I do THANK you kindly for trying @WorldsElite

Would it be helpful, if I post my note.php, from /api ?
 

abelcustoms

Well-known member
Joined
Jun 29, 2021
Messages
210
Awards
3
Offline
not every panel is the same to be honest, the api's been re written a few times and if im right that call got rewritten and moved the the api.php. for V4. So if you see note.php in the api folder is not a true v4.
Yes, using the FTG v4 based panel, I did try adding "ORDER BY ID DESC, and it didn't work for me
Cleared cache, etc still no dice. Not changing order on panel, nor within the APK

Although, I thought it would be something simple, turns out it's not

I do THANK you kindly for trying @WorldsElite

Would it be helpful, if I post my note.php, from /api ?
 

WorldsElite

HELP WHEN I CAN
Joined
Jun 4, 2021
Messages
176
Awards
3
Offline
not every panel is the same to be honest, the api's been re written a few times and if im right that call got rewritten and moved the the api.php. for V4. So if you see note.php in the api folder is not a true v4.
Just checked the panels here yup that's correct 🤦.

Just look for the following in the api/api.php

PHP:
$note = $db->query('SELECT * FROM note');

Replace with

PHP:
$note = $db->query('SELECT * FROM note ORDER BY ID DESC');

Tested and working on panels here.
 

blackestflag

Well-known member
Joined
Oct 19, 2022
Messages
491
Awards
4
Offline
Just checked the panels here yup that's correct 🤦.

Just look for the following in the api/api.php

PHP:
$note = $db->query('SELECT * FROM note');

Replace with

PHP:
$note = $db->query('SELECT * FROM note ORDER BY ID DESC');

Tested and working on panels here.
I literally was just searching api.php fpr the same snippet after reading ONLY Abel's reply...

Working here as well, thank you all so much for helping.
I'm going to have a poke around, see if I can get the panel to display by DESC as well
Shouldn't be too hard, lol

Again, mad props to you guys
 

WorldsElite

HELP WHEN I CAN
Joined
Jun 4, 2021
Messages
176
Awards
3
Offline
I literally was just searching api.php fpr the same snippet after reading ONLY Abel's reply...

Working here as well, thank you all so much for helping.
I'm going to have a poke around, see if I can get the panel to display by DESC as well
Shouldn't be too hard, lol

Again, mad props to you guys
In the your panellocation/note.php

Look for

PHP:
$res = $db->query('SELECT * FROM ' . $table_name);

And replace with

PHP:
$res = $db->query('SELECT * FROM ' . $table_name . ' ORDER BY id DESC');
 

blackestflag

Well-known member
Joined
Oct 19, 2022
Messages
491
Awards
4
Offline
In the your panellocation/note.php

Look for

PHP:
$res = $db->query('SELECT * FROM ' . $table_name);

And replace with

PHP:
$res = $db->query('SELECT * FROM ' . $table_name . ' ORDER BY id DESC');
Winner Winner Chicken Dinner

Thanks again @WorldsElite , such a suitable name you have ;)
 

abelcustoms

Well-known member
Joined
Jun 29, 2021
Messages
210
Awards
3
Offline
I literally was just searching api.php fpr the same snippet after reading ONLY Abel's reply...

Working here as well, thank you all so much for helping.
I'm going to have a poke around, see if I can get the panel to display by DESC as well
Shouldn't be too hard, lol

Again, mad props to you guys
i mean i did write the api you guys are using i should know 🥹
glad you got it solved bud.
 
Top