Having the “Ooooops, something went wrong! If you can see this message, this is probably a misconfiguration in Grocery CRUD Enterprise!” issue.
I did watch the video about fixing this problem, but it didn’t seem to help.
Here’s the basic info: PHP 8.2.x. CodeIgniter 4.7.4. GC 3.2.11 Enterprise. Not using composer, followed the wizard to the best of my ability.
Copied all the files into an existing (if barebones) CI project.
Base URL and pointer to the assets directory appears to be correct. in config/App.php I have public string $baseURL = 'http://localhost/precdb'; and in config/GroceryCrud.php I have 'assets_folder' => base_url() . '/vendor/grocery-crud/',
No errors related to GC show up in the browser console:
(the Type error seems to be related to a browser plugin I have, diigo).
I also created a test.html file and put it into public/vendor/grocery-crud. If, in my browser, I then go to http://localhost/precdb/vendor/grocery-crud/test.html, the test file correctly displays. So I think the path to the asset folder is correct?
The other thing that’s revealing is when I run in debug mode and put a breakpoint in my View file, for $js_files I see an array with one entry, http://localhost/precdb//vendor/grocery-crud/static/js/main.v3.2.11.2bf1c5db.js and for $css_files I see an array with zero entries…
And, sure enough, the source code for the resulting page shows that one js file and no css files.
So maybe js_files and css_files isn’t being generated correctly by $crud->render()?
Here’s my view file (listview):
<div style='height:20px;'></div>
<tr><td>
<?php
foreach($css_files as $file): ?>
<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<?php foreach($js_files as $file): ?>
<script src="<?php echo $file; ?>"></script>
<?php endforeach; ?>
<div>
<?php echo $output; ?>
</div>
</td></tr>
and here’s the relevant part of the controller:
$output = $crud->render();
return $this->_example_output($output, $rawsearch);
...
private function _example_output($output = null, $rawsearch = null) {
if (isset($output->isJSONResponse) && $output->isJSONResponse) {
header('Content-Type: application/json; charset=utf-8');
echo $output->output;
exit;
}
return view('header')
. view('navbarbasic')
. view('searchterms', array('searchtext' => $rawsearch))
. view('listview', (array)$output)
. view('footer');
}
The other view files handle parts of the page not directly related to GC.
If you need to see other parts of my app, please let me know what and I’ll be happy to post it.
Thanks!