Introduction to the Xataface API[Permalink]Back to the wiki SynopsisXataface is provides an API to help in developing your own custom actions. This API includes objects and functions to more easily interact with the database (i.e. search, edit, delete, and save records), build forms, use templates, and more. This section of the wiki endeavors to highlight some of the more useful and commonly used aspects of the API. The dataface-public-api.php FacadeMuch of the functionality provided by the Xataface API is wrapped up easy-to-use functions which are made available in the dataface-public-api.php script, which is always present in a Xataface application (it is loaded at the beginning of your index.php file). Some Common TasksLoading a Single Record from the Database
In the above examples we load a Dataface_Record object and use the val() method to display particular field values. The 2nd arguments of df_get_record() is an array which serves as a query. See URL Conventions for more examples of the types of queries that you can provide here. Loading a set of records from the Database
Caveat: Note that when loading records using df_get_records_array() it only loads a preview of each record for memory's sake. A preview of the record is the same as a full record except that all fields are truncated to be less than 255 characters. If you have long text fields that you need to load, then these will be truncated. There are a few different solutions if you need to load the entire contents of a long field, including:
Editing and Saving a Record
blog comments powered by Disqus
|