api icon indicating copy to clipboard operation
api copied to clipboard

FT 3.01 - API + Visualization on same PHP page (API 2.x)

Open ghost opened this issue 7 years ago • 2 comments

Individual ("use in your own pages") visualization code on external PHP page - works OK.

Individual API function code e.g. showSubmissions() on external page - works OK.

Combining both pieces of code on one page causes second element to be ignored and page does not render completely.

MULTIPLE graphs work OK on same page alone MULTIPLE API functions work OK on same page alone

Cannot get Visualization and API code to work on same page.

ghost avatar Apr 22 '18 23:04 ghost

Thanks @tidalfire! I'll check this out and get back to you.

benkeen avatar Apr 23 '18 04:04 benkeen

Ben,

More info ... may help.

DON'T WORK - recap If the first object on the page is a Visualization object and the second is e.g. showSubmissions() then the page stops rendering before it gets to the showSubmissions section.

If the first object is showSubmissions() and second is Visualization - page stops rendering after showSubmissions.

WORKS If first object is showSubmissions() and second object is Visualization and I comment out the start_sessions false line from the Visualization code for this module and subsequent Visualizations then all renders as expected.

If I want Visualization to be first object on page I need to add the 2 lines from the showSession() API as the start code and then follow with Visualization code.

So to have Visualization as first object code(?) looks like this:

require(code for API.class.php) $api = new FormTools\API()

VISUALIZATION CODE + comment out star_sessions line

Another VISUALIZATION CODE + comment all code up to $width and $height

Add showSessions() code Ony require $page and $api lines as first 2 lines already added.

All works - off for lie down...

T

ghost avatar Apr 23 '18 16:04 ghost