Database query order |
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!
That's not part of CodeIgniter, you can try to find the function by searching for "function shortcode" and see what parameters it accepts.
(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!
@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')". (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()){
Okey, that means you should look in the "run" function inside Pages_model (possible in application/models).
(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! |
Welcome Guest, Not a member yet? Register Sign In |