Database query order - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19) +--- Thread: Database query order (/showthread.php?tid=74653) |
Database query order - chrisco - 10-20-2019 Hello, I have the following code: Code: <?php echo $this->template->shortcode('pages', array('template' => 'default', 'id' => '45', 'limit' => '3')) ?> And one more this, what exactly means $this->template->shortcode Cheers! RE: Database query order - jreklund - 10-20-2019 That's not part of CodeIgniter, you can try to find the function by searching for "function shortcode" and see what parameters it accepts. RE: Database query order - php_rocs - 10-20-2019 @chrisco, Also, we need more information/code. The code that you displayed is it in a view? If so, what controller is calling the view? Has this code worked before? Are you seeing error messages? What version of CI are you using? RE: Database query order - chrisco - 10-20-2019 (10-20-2019, 06:21 AM)jreklund Wrote: That's not part of CodeIgniter, you can try to find the function by searching for "function shortcode" and see what parameters it accepts. Hello jreklund, I found the function Code: function shortcode($path = 'pages'){ (10-20-2019, 06:43 AM)php_rocs Wrote: @chrisco, Hi php_rocs, Yes, the code that I displayed is in the view, how can I found out which controller is calling the view? The code is working, but I need it to display the newest 3 publications and not just the first 3 publications in a database like it is now. CI version is 3.1.10 Cheers! RE: Database query order - php_rocs - 10-20-2019 @chrisco, Simply do a search in your code to find "view('THE_NAME_OF_THE_VIEW_FILE')" where THE_NAME_OF_THE_VIEW_FILE is the name of the view file without the .php suffix. So for example if the view name is header.php then the statement to search for would be... "view('header')". RE: Database query order - jreklund - 10-20-2019 @chrisco, Do you have any more function by that name? As it dosen't have a second parameter. RE: Database query order - chrisco - 10-20-2019 (10-20-2019, 10:15 AM)jreklund Wrote: @chrisco, Yep I found this in Template.php in the libraries folder Code: function shortcode($model, $data = array()){ RE: Database query order - jreklund - 10-21-2019 Okey, that means you should look in the "run" function inside Pages_model (possible in application/models). RE: Database query order - chrisco - 10-22-2019 (10-21-2019, 10:47 AM)jreklund Wrote: Okey, that means you should look in the "run" function inside Pages_model (possible in application/models). This is what I did yesterday and fix my problem by adding this to run function: Code: public function run($params = array()) and append "order" param in my view to order them by date Code: $this->template->shortcode('pages', array('template' => 'default', 'id' => '45', 'order' => 'date', 'limit' => '3')) Thanks for your help! |