How to set this up to use as a include?

QuestionsHow to set this up to use as a include?
Michael W Olson asked 2 years ago

Hi. I am pretty new with tis and I am not sure how to ask this.

 

But when I created my first grid I noticed that they wanted me to use the standard HTML page tags, Document, HTML, Head, Body, etc….

When I remove these tags it throws off the display of the grid.

 

Eventually I would like to implement this as a dynamic include. I am pretty sure how to do that but how can I get the grid to display properly without the standard HTML page tags?

2 Answers
Michael answered 2 years ago

ok so the following code works as standalone. But if I try to use the file as an include it will create the grid frae but then throws an error and not populate the grid frame with data.


PHPGRID_DBTYPE,
"server" => PHPGRID_DBHOST,
"user" => PHPGRID_DBUSER,
"password" => PHPGRID_DBPASS,
"database" => PHPGRID_DBNAME
);
$g = new jqgrid($db_conf);

// set few params
$opt["caption"] = "Sample Grid";
$g->set_options($opt);
// set database table for CRUD operations
$g->table = "clients";
// render grid and get html/js output
$out = $g->render("list1");
?>

Abu Ghufran Staff answered 2 years ago

Hello,

Correct way to is to place the php datagrid code – till render() function – above any html code. If you put datagrid code after html tags then it will not render.

You can then use echo $out statement where in html you want to show the datagrid.

It is mentioned in this article: https://www.gridphp.com/docs/creating-first-grid/

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

2 + 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?