Welcome Guest, Not a member yet? Register   Sign In
Database query order
#4

(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'){
        $this->load->helper('file');

        $data = [
            //['id' => '', 'text' => '-- Default --'],
        ];
        $layout_files = get_dir_file_info(APPPATH . '/views/shortcodes/'.$path.'/', FALSE);

        if (is_array($layout_files))
        {
            sort($layout_files);
            foreach($layout_files as $key => $file_info)
            {
                $pathinfo = pathinfo($file_info['name']);
                if($pathinfo['extension'] == 'php' && $pathinfo['filename'] != 'default'){
                    $data[] = ['id' => $pathinfo['filename'], 'text' => $pathinfo['filename']];
                }
            }
        }
        header('Content-Type:application/json; charset=utf-8');
        exit(json_encode($data));
    }


(10-20-2019, 06:43 AM)php_rocs Wrote: @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?

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!
Reply


Messages In This Thread
Database query order - by chrisco - 10-20-2019, 05:27 AM
RE: Database query order - by jreklund - 10-20-2019, 06:21 AM
RE: Database query order - by php_rocs - 10-20-2019, 06:43 AM
RE: Database query order - by chrisco - 10-20-2019, 06:56 AM
RE: Database query order - by php_rocs - 10-20-2019, 09:53 AM
RE: Database query order - by jreklund - 10-20-2019, 10:15 AM
RE: Database query order - by chrisco - 10-20-2019, 12:41 PM
RE: Database query order - by jreklund - 10-21-2019, 10:47 AM
RE: Database query order - by chrisco - 10-22-2019, 01:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB