ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Change Webchartviewer callBackURL?
Posted by Rick on Oct-23-2012 03:38
I am integrating ChartDirector PHP into the Yii framework, and have run into the problem
where Webchartviewer's callBackURL refers to the framework's index bootstrap file and
not the original page that generated the webpage. I can load the original full page fine, the
AJAX call back the the server gets misdirected by and incorrect callBackURL in
WebChardViewer.

This question was also asked in 2007:
http://www.chartdir.com/forum/download_thread.php?
bn=chartdir_support&pattern=change+callBackURL&thread=1193867255#N1193893937

Answer (d) which is the preferred one, but I don't understand the solution at all.

I was wondering if there are any new solutions to this problem.

Thanks!
Rick

  Re: Change Webchartviewer callBackURL?
Posted by Peter Kwan on Oct-24-2012 01:49
Hi Rick,

To construct the callback URL, ChartDirector needs to determine the original URL. The only method that ChartDirector can determine the original URL is to query the web framework. In PHP, it is the PHP variable $_SERVER["SCRIPT_NAME"].

If the URL contains query parameter (as reported by $_SERVER["QUERY_STRING"]), ChartDirector will also include the query parameter in the callback URL (in case the query parameter is needed for "routing" the page), up to a maximum of 255 characters.

If the URL reported by the PHP variable $_SERVER["SCRIPT_NAME"] does not reflect "the original page that generated the webpage", it seems there is no general way that can be used to determine the correct URL to use (as it is framework dependent or application specific). In this case, you would need to change $_SERVER["SCRIPT_NAME"] to the URL that suits your framework or application before calling ChartDirector.

Hope this can help.

Regards
Peter Kwan

  Re: Change Webchartviewer callBackURL?
Posted by Rick on Oct-24-2012 04:17
Thanks Peter, That works like a champ.

Last night I also found another workaround. I noticed that WebChartViewer also generated
a hidden text field with the id of <chartName>_callBackURL. Simply updating the value
during JS document.ready results in the correct action.

But, it's better to handle it on the PHP side!

Rick