I'm using drupal 7. I want to create a php script that uses Drupals DB abstraction layer to query the database and spit out JSON data. Where would I place such a script? At the moment, I've done it in a round-about way by create a new node, then in the
function theme_process_page() of my
theme/template.php, I wrote an IF statement to detect the node id, then run my code, then call a die() statement.
Is there a more appropriate place for me to put this script?
** additional notes **
This script is to be called every time a person presses "Provide a menu link" when adding/editing a node in the CMS. The script will then automatically select the appropriate
Parent Item and
weight based on any other existing translation.