⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Setup Example Not Working



Mugs321

Mugs321
  • profile picture
  • Member

Posted 23 June 2018 - 15:02 PM

Hi all,

 

Just tried to install GC and all I'm getting is a "Loading.." message and an "OK" button when I run example.php (see attached). 

 

No errors or anything else being displayed.

 

Any assistance would be appreciated!


Mugs321

Mugs321
  • profile picture
  • Member

Posted 23 June 2018 - 20:29 PM

I'm guessing this has something to do with the CSS and JS libraries?  I can run GC fine as its own website, but I can't seem to get it integrated properly into my existing site.  Could the CSS/JS libraries be conflicting with my existing Bootstrap and JQuery references?

 

I've got it "working" in so far as I'm using an iframe to point to my standalone GC instance, but I'd really like to get this integrated properly.


Mugs321

Mugs321
  • profile picture
  • Member

Posted 23 June 2018 - 21:19 PM

Ok.. Making progress!  I've got all my CSS and JS references sorted out I think, but now I'm getting this error:  

SyntaxError: Unexpected token < in JSON at position 6

 

I'm using the following code inline with my app:

$crud = new GroceryCrud($config, $database);

$crud->setTable('tblItems');
$crud->setSubject('Item', 'Items');

$output = $crud->render();

if ($output->isJSONResponse) {
    header('Content-Type: application/json; charset=utf-8');
    echo $output->output;
    exit;
}

$output = $output->output;

echo '<div>'.$output.'</div>';

If I comment out my "echo $output" line at the end of the script, the page loads fine but of course Grocery CRUD doesn't display.  

 

I feel like I'm really close!  :)


Mugs321

Mugs321
  • profile picture
  • Member

Posted 24 June 2018 - 16:27 PM

Was never able to get this working without iFrame, but it's definitely better than it was before.  Using the following library to embed iFrame seamlessly:

 

https://github.com/davidjbradshaw/iframe-resizer/