trying to render 2 grids in the same page error

Questionstrying to render 2 grids in the same page error
BiLe asked 3 years ago

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?

3 Answers
BiLe answered 3 years ago

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"] = "";
...

BiLe answered 3 years ago

changed this and it is working:

include_once(“gridphp/gridphp-full-v2.8/config.php”);
include_once(PHPGRID_LIBPATH.”inc/jqgrid_dist.php”);

Abu Ghufran Staff answered 3 years ago

Thanks for the update.

Solution was to use include_once instead of include.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

4 + 15 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?