How to find SQL of phorum_db_get_recent_messages?
Posted by jernej
|
How to find SQL of phorum_db_get_recent_messages? November 19, 2008 01:13PM |
Registered: 17 years ago Posts: 56 |
Hi there
I tried calling function phorum_db_get_recent_messages with $msgs = phorum_db_get_recent_messages(10,0,0,0,"LIST_RECENT_MESSAGES"); but I get always same messages no matter if I use LIST_RECENT_MESSAGES or one of the other 2 options.
What I need is the SQL query Phorm is making to list last 10 updated threads. I seem to can not find this SQL :-( I'd like to integrate last 10 udpated threads to my site.
Yours
Jerry
I tried calling function phorum_db_get_recent_messages with $msgs = phorum_db_get_recent_messages(10,0,0,0,"LIST_RECENT_MESSAGES"); but I get always same messages no matter if I use LIST_RECENT_MESSAGES or one of the other 2 options.
What I need is the SQL query Phorm is making to list last 10 updated threads. I seem to can not find this SQL :-( I'd like to integrate last 10 udpated threads to my site.
Yours
Jerry
|
Re: How to find SQL of phorum_db_get_recent_messages? November 19, 2008 01:19PM |
Admin Registered: 21 years ago Posts: 8,532 |
LIST_RECENT_MESSAGES is a constant, not a string.
So try dropping the quotes around it.
The exact SQL is generated from phorum_db_get_recent_messages(). The function is quite complicated, because of all the optimization that is done. If you need the query instead of the plain function (but why would you if the function works?), then do the required function call and add some code in the db layer to print the query.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
So try dropping the quotes around it.
The exact SQL is generated from phorum_db_get_recent_messages(). The function is quite complicated, because of all the optimization that is done. If you need the query instead of the plain function (but why would you if the function works?), then do the required function call and add some code in the db layer to print the query.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: How to find SQL of phorum_db_get_recent_messages? November 19, 2008 01:20PM |
Admin Registered: 23 years ago Posts: 9,240 |
|
Re: How to find SQL of phorum_db_get_recent_messages? November 19, 2008 01:29PM |
Registered: 17 years ago Posts: 56 |
Agh, I am ashamed. I was looking at the solution from one of your members (quite old) and there were quotes around it...
The reason why I need SQL is because I use ASP for my main site :-/ But I was thinking in adding last 10 updated threads using ajax include page in div, so I can include PHP page to ASP page.
Just my final question: Is there a way to simply have 10 last threads like they are in the one forum list (list.php?1) I guess I have to customise the list template to do that and name it last.tpl. Hovever I have no idea of how to call a template page, is the template page self sustained? I need a php page last.php to cover last.tpl?
Jerry
The reason why I need SQL is because I use ASP for my main site :-/ But I was thinking in adding last 10 updated threads using ajax include page in div, so I can include PHP page to ASP page.
Just my final question: Is there a way to simply have 10 last threads like they are in the one forum list (list.php?1) I guess I have to customise the list template to do that and name it last.tpl. Hovever I have no idea of how to call a template page, is the template page self sustained? I need a php page last.php to cover last.tpl?
Jerry
|
Re: How to find SQL of phorum_db_get_recent_messages? November 19, 2008 04:22PM |
Admin Registered: 21 years ago Posts: 8,532 |
I would say that you could implement an addon module for that. This is a module that uses the "addon" hook for implementing extra scripts for Phorum. Using that, you can implement any script that you like. The module can contain its own templates, so you wouldn't have to change the main template for this. The Google Maps module implements an addon. You could take a look at that one to see how it's done.
When using Ajax, you could also implement an AJAX call. Phorum 5.2 does have an ajax.php script that can be used to use some standard calls and to implement extra ones. Phorum AJAX uses JSON as the data transport. You could take a look at the message previes module to see how to implement ajax calls in Phorum modules.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
When using Ajax, you could also implement an AJAX call. Phorum 5.2 does have an ajax.php script that can be used to use some standard calls and to implement extra ones. Phorum AJAX uses JSON as the data transport. You could take a look at the message previes module to see how to implement ajax calls in Phorum modules.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: How to find SQL of phorum_db_get_recent_messages? November 19, 2008 10:42PM |
Registered: 17 years ago Posts: 56 |
Sorry, only registered users may post in this forum.