Hello,
I have a grid-1.php, which will render a CRUD table from database.
Works!
On the same page, I am now trying to render a copy of grid-1.php, which I have called grid-2.php.
I am using regularlabs sourcerer with Joomla 4 Module, in order to render the table inside my pagebuilder.
The only line that is different in those 2 files is:
$out = $g->render(“grid1”);
echo $out;
$out = $g->render(“grid2”);
echo $out;
Any idea, why I get an error with the page, when I try to render 2 grids?
Would you need the source code for the grid?
both files begin like this:
defined('_JEXEC') or die;
include_once("gridphp/gridphp-full-v2.8/config.php");
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
// get connection
$db_conf = array(
"type" => PHPGRID_DBTYPE,
"server" => PHPGRID_DBHOST,
"user" => PHPGRID_DBUSER,
"password" => PHPGRID_DBPASS,
"database" => PHPGRID_DBNAME
);
// get joomla
$user = JFactory::getUser();
$user_id = $user->get('id');
if(empty($user_id)) {
$user_id = 0;
}
$g = new jqgrid($db_conf);
// option
$opt["caption"] = "";
...
changed this and it is working:
include_once(“gridphp/gridphp-full-v2.8/config.php”);
include_once(PHPGRID_LIBPATH.”inc/jqgrid_dist.php”);
Thanks for the update.
Solution was to use include_once instead of include.