DATAGRID_DIR on localhost

Talk about installation process and problems

Moderator: alexandrleonenko

ga1964
Newbie
Newbie
Posts: 2
Joined: Dec 16th, '14, 20:45

DATAGRID_DIR on localhost

Postby ga1964 » Dec 16th, '14, 21:21

Hi,

I'm having a problem getting started with DataGrid. I'm trying to use it on my MAMP-driven localhost. The way I have my localhost set up to run is by putting all my different sites in a subdirectory, so I'd have something like:

http://localhost/site1 mapped to /Users/ga1964/Documents/localhost/site1
http://localhost/site2 mapped to /Users/ga1964/Documents/localhost/site2

etc.

Now I have DataGrid stored in /Users/ga1964/Documents/localhost/site1/libs/apphp/PHPDG_700/datagrid.class.php

If I leave DATAGRID_DIR as it is (ie. blank) it displays the grid without much in the way of styling (icons missing and such) and issues errors like:

"Cannot find file: js/dg.js. Check if this file exists and you use a correct path!"

and the debug output says things like:

-----
Warnings:

1) Your language interface option is turned on, but the system was failed to open stream: "languages/.php".
No such file or directory. Please check it or return the language option to default value: "en"!
2) Cannot find file: styles/default/style.css. Check if this file exists and you use a correct path!
-----

If I give DATAGRID_DIR an absolute path, the errors go away but it still doesn't display nicely (icons and such) because the URL for images, styles and such is getting the absolute path appended, such as:

http://localhost/Users/ga1964/Documents/localhost/site1

Which of course fails.

If I give DATAGRID_DIR a relative path such as "../datagrid/" PHP tells me it can't find "../datagrid/classes/helper.class.php".

I then tried being a bit cleverer (always dangerous!) and told it to use: "dirname($_SERVER['PHP_SELF']) . '/libs/apphp/PHPDG_799/datagrid/'" but that didn't work either.

I think this might be something particular to the way I run things on localhost but I've managed to get most other stuff running okay. It strikes me that I need a separate DATAGRID_DIR for path references (like includes and such) and something like a DATAGRID_URL for any web-facing stuff like style sheets, javascript and images.

Is there a way I can do this? Or have I missed something completely obvious?

Many thanks.

ga1964
Newbie
Newbie
Posts: 2
Joined: Dec 16th, '14, 20:45

Re: DATAGRID_DIR on localhost

Postby ga1964 » Dec 16th, '14, 22:22

Well I found a workaround for this.

Basically, I set the DATAGRID_DIR to "/site1/libs/apphp/PHPDG_700/datagrid/", changed the requires for the helper and sqlparser to include them directly and made sure DataGrid's "IsFileExists" function always returns true.

It's all a bit of a hack but it works now and I'm pretty sure (or at least I hope) that this problem is particular to the way I use my localhost setup.


Return to “Installation”