Clean up
This commit is contained in:
parent
e2bed4ac2e
commit
1498e887b8
@ -1,13 +0,0 @@
|
|||||||
Welcome to the TodayCMS docs. This site contains documentation and examples of how to use TodayCMS, the powerful Content Management System. Here is a breakdown of what this documentation will cover.
|
|
||||||
|
|
||||||
## API
|
|
||||||
The api is the server endpoint for creating, reading, updating and deleting objects from collections in the database.
|
|
||||||
|
|
||||||
##Config
|
|
||||||
The config is used to define the objects in your collections in json.
|
|
||||||
|
|
||||||
## Editor
|
|
||||||
The editor is an embedable tool, for creating and updating objects in a collection.
|
|
||||||
|
|
||||||
## PHP SDK
|
|
||||||
The PHP SDK is a file called connector.php that makes it easier to work with the API. It contains helpers and functions that map to API calls.
|
|
@ -1,15 +0,0 @@
|
|||||||
## Introduction
|
|
||||||
|
|
||||||
:TODO
|
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
:TODO
|
|
||||||
|
|
||||||
## Formatting
|
|
||||||
|
|
||||||
:TODO
|
|
||||||
|
|
||||||
## Requests and Responses
|
|
||||||
|
|
||||||
:TODO
|
|
@ -1,5 +0,0 @@
|
|||||||
All calls to the api must include a _token parameter to validate the call.
|
|
||||||
|
|
||||||
http://todaycms-api.herokuapp.com/?_token=XXXXXXXXXXXX
|
|
||||||
|
|
||||||
This guide will not include the _token in the sample calls. It is implied that it must be included.
|
|
@ -1,35 +0,0 @@
|
|||||||
The following collection config will be used as the config throughout the example calls in this guide.
|
|
||||||
|
|
||||||
{
|
|
||||||
"team": {
|
|
||||||
"title": "Team Members",
|
|
||||||
"type": "multiple",
|
|
||||||
"fields": {
|
|
||||||
"name": {
|
|
||||||
"title": "Name",
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
"employment": {
|
|
||||||
"title": "Employment Status",
|
|
||||||
"type": "select",
|
|
||||||
"options": {
|
|
||||||
"half": "Part Time",
|
|
||||||
"full": "Full Time",
|
|
||||||
"retired": "Retired"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"age": {
|
|
||||||
"title": "Age",
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
"bio": {
|
|
||||||
"title": "Bio",
|
|
||||||
"type": "textarea"
|
|
||||||
},
|
|
||||||
"address": {
|
|
||||||
"title": "Home Address",
|
|
||||||
"type": "location"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
To create an object in a collection, issue a HTTP POST call with the object in the body of the POST.
|
|
||||||
|
|
||||||
POST /collections/:collection
|
|
||||||
|
|
||||||
##URL Parameters
|
|
||||||
|
|
||||||
`:collection` is the key of the collection in the config.
|
|
||||||
|
|
||||||
##Example
|
|
||||||
|
|
||||||
POST /collections/team
|
|
||||||
|
|
||||||
name = Justin
|
|
||||||
employment = full
|
|
||||||
bio = Node.js developer
|
|
||||||
address[city] = Bismarck
|
|
||||||
address[state] = ND
|
|
||||||
address[zip] = 58501
|
|
||||||
...
|
|
||||||
|
|
||||||
Note: 'team' is the key used in our example config at the top of this guide
|
|
||||||
|
|
||||||
##Returns
|
|
||||||
|
|
||||||
The object you just created.
|
|
@ -1,54 +0,0 @@
|
|||||||
To read all objects from a collection, issue a HTTP GET call
|
|
||||||
|
|
||||||
Entire Collection:
|
|
||||||
|
|
||||||
GET /collections/:collection
|
|
||||||
|
|
||||||
Single Object:
|
|
||||||
|
|
||||||
GET /collections/:collection/:id
|
|
||||||
|
|
||||||
|
|
||||||
### URL Parameters
|
|
||||||
|
|
||||||
`:collection` is the key of the collection in the config.
|
|
||||||
`:id` [optional]: is the id of an object in the collection.
|
|
||||||
|
|
||||||
### Query Parameters
|
|
||||||
|
|
||||||
All query parameters are optional.
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| `slug` | String | Find record with the matching slug |
|
|
||||||
| `filter` | JSON Object | Filters the results - [Read More about Filtering](/API/Filtering) |
|
|
||||||
| `sort` | JSON Object | Sorts the results - [Read More about Sorting](/API/Sorting) |
|
|
||||||
| `limit` | Integer | Limit the number of results |
|
|
||||||
| `offset` | Integer | Offset the results |
|
|
||||||
| `count` | Boolean | Returns the count of matching records |
|
|
||||||
|
|
||||||
### Paging
|
|
||||||
|
|
||||||
To page the results, use the `limit` and `offset` parameters together. For example, if you wanted to page your results 20 at a time and you want the 3rd page of results, you would make the following call:
|
|
||||||
|
|
||||||
GET /collections/:collection?limit=20&offset=40
|
|
||||||
|
|
||||||
This would return results 41-60 from your collection
|
|
||||||
|
|
||||||
### Count
|
|
||||||
|
|
||||||
To only recieve the number of results that match the get request, you can send the optional `count` paramenter. This is helpful for finding the number of matches for a filter, or other types of linear data.
|
|
||||||
|
|
||||||
Example Call:
|
|
||||||
|
|
||||||
GET /collections/:collection?count=true
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
{
|
|
||||||
"count": 47
|
|
||||||
}
|
|
||||||
|
|
||||||
### Returns
|
|
||||||
|
|
||||||
An array of objects from the collection.
|
|
@ -1,27 +0,0 @@
|
|||||||
To update an object in a collection, issue a HTTP `PUT` call with the object in the body of the POST.
|
|
||||||
|
|
||||||
PUT /collections/:collection/:id
|
|
||||||
|
|
||||||
name = Justin Walsh
|
|
||||||
employment = part
|
|
||||||
bio = Documention writer
|
|
||||||
...
|
|
||||||
|
|
||||||
### URL Parameters
|
|
||||||
|
|
||||||
`:collection` is the key of the collection in the config.
|
|
||||||
|
|
||||||
`:id` is the id of the object you want to update.
|
|
||||||
|
|
||||||
|
|
||||||
### Query Parameters
|
|
||||||
|
|
||||||
All query parameters are optional.
|
|
||||||
|
|
||||||
| Parameter | Type | Default | Description |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| `overwrite` | Boolean | `false` | Setting this to `true` will force the server to completely overwrite the object in the database instead of doing a partial update |
|
|
||||||
|
|
||||||
### Returns
|
|
||||||
|
|
||||||
The object you just updated.
|
|
@ -1,13 +0,0 @@
|
|||||||
To delete an object in a collection, issue a HTTP `DELETE` call with the id of the object you wish to delete in the url.
|
|
||||||
|
|
||||||
DELETE /collections/:collection/:id
|
|
||||||
|
|
||||||
**URL Parameters**
|
|
||||||
|
|
||||||
`:collection` is the key of the collection in the config.
|
|
||||||
|
|
||||||
`:id` is the id of the object you want to delete.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
The object you just deleted.
|
|
@ -1,152 +0,0 @@
|
|||||||
To filter an api call, send the optional `filter` parameter. The filter parameter is a structured json object. Examples use the following terms:
|
|
||||||
|
|
||||||
* field key - Is the key used to define the field in the config.
|
|
||||||
* operator - Is the comparison to preform.
|
|
||||||
* value - Is what we will compare the object value to.
|
|
||||||
|
|
||||||
## Basic Structure
|
|
||||||
|
|
||||||
This is the most basic filter that can be preformed.
|
|
||||||
|
|
||||||
{
|
|
||||||
"field key": "value"
|
|
||||||
}
|
|
||||||
|
|
||||||
*Example Call:*
|
|
||||||
|
|
||||||
GET /collections/team?filter={"employment":"full"}
|
|
||||||
|
|
||||||
This will find all full time team members in the collection.
|
|
||||||
|
|
||||||
## Advanced Structure
|
|
||||||
|
|
||||||
This structure allows more advanced control over operators used when filtering.
|
|
||||||
|
|
||||||
{
|
|
||||||
"field key": {
|
|
||||||
"operator": "value"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*Example Call:*
|
|
||||||
|
|
||||||
GET /collections/team?filter={"employment": {"!=": "retired"}}
|
|
||||||
|
|
||||||
This will find all team members who are not retired in the collection.
|
|
||||||
|
|
||||||
## Multiple Operators Structure
|
|
||||||
|
|
||||||
You can preform multiple comparision operations on the same field
|
|
||||||
|
|
||||||
{
|
|
||||||
"field key": {
|
|
||||||
"operator": "value",
|
|
||||||
"operator2": "value2",
|
|
||||||
"operatorx..": "valuex.."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*Example Call:*
|
|
||||||
|
|
||||||
GET /collections/team?filter={"name": {"LIKE":"Justin%", "!=":"Justin Walsh"}}
|
|
||||||
|
|
||||||
This will find all team members who's names start with 'Justin' but are not 'Justin Walsh'.
|
|
||||||
|
|
||||||
## Multiple Fields Structure
|
|
||||||
|
|
||||||
You can filter multiple fields by adding each field key to the object.
|
|
||||||
|
|
||||||
{
|
|
||||||
"field key 1": "value",
|
|
||||||
"field key 2": {
|
|
||||||
"operator": "value"
|
|
||||||
},
|
|
||||||
"field key 3": {
|
|
||||||
"operator": "value"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
## Multiple Values Structure
|
|
||||||
|
|
||||||
When filtering, you can use an array instead of a string to match any of the values in the array.
|
|
||||||
|
|
||||||
{
|
|
||||||
"employment": ["full", "part"],
|
|
||||||
"name": {
|
|
||||||
"LIKE": ["Justin%", "Brian%"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
This will match all team members who are full or part time, and whose names starts with 'Justin' or 'Brian'.
|
|
||||||
|
|
||||||
Note: `"employment": ["full", "part"]` is equvalient to
|
|
||||||
|
|
||||||
"employment": {
|
|
||||||
"=": ["full", "part"]
|
|
||||||
}
|
|
||||||
|
|
||||||
## Nested Fields Structure
|
|
||||||
|
|
||||||
You can filter by nested fields in the object using a dot notation syntax as the field key in the filter. This syntax can be used to query deep into nested objects and arrays, including fields like the 'multi'.
|
|
||||||
|
|
||||||
{
|
|
||||||
"address.zip": "58501"
|
|
||||||
}
|
|
||||||
|
|
||||||
This will filter the location field type by zip code, which is a nested field. This example is based on the sample config at the top of this guide.
|
|
||||||
|
|
||||||
## AND/OR Fields Structure (Not Supported Yet)
|
|
||||||
|
|
||||||
This structure allows a very customized query including both `-and` and `-or` statments.
|
|
||||||
|
|
||||||
{
|
|
||||||
"field key 3": {
|
|
||||||
"operator": "value"
|
|
||||||
},
|
|
||||||
"-or": {
|
|
||||||
"field key 1": "value",
|
|
||||||
"-and": {
|
|
||||||
"field key 2": {
|
|
||||||
"operator": "value"
|
|
||||||
},
|
|
||||||
"field key 4": {
|
|
||||||
"operator": "value"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
## Supported Operators
|
|
||||||
|
|
||||||
| Operator | Description |
|
|
||||||
| :--- | :--- |
|
|
||||||
| = | equal to |
|
|
||||||
| != | not equal to |
|
|
||||||
| > | greater than |
|
|
||||||
| < | less than |
|
|
||||||
| >= | greater than or equal to |
|
|
||||||
| <= | less than or equal to |
|
|
||||||
| LIKE | case sensitive search, use '%' for wildcard |
|
|
||||||
| ILIKE | case insensitive search, use '%' for wildcard |
|
|
||||||
| NOT LIKE | inverse of 'LIKE' |
|
|
||||||
| NOT ILIKE | inverse of 'ILIKE' |
|
|
||||||
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
**JSON Filtering**
|
|
||||||
|
|
||||||
The JSON object used for the `filter` parameter must be url encoded when calling the api. Here are examples of how to url encode a json object or string in different languages.
|
|
||||||
|
|
||||||
***php***
|
|
||||||
|
|
||||||
$escaped_json = urlencode('{"name": {"LIKE":"Justin%", "!=":"Justin Walsh"}}');
|
|
||||||
|
|
||||||
***javascript string***
|
|
||||||
|
|
||||||
var escaped_json_from_string = escape('{"name": {"LIKE":"Justin%", "!=":"Justin Walsh"}}');
|
|
||||||
|
|
||||||
***javascript object***
|
|
||||||
|
|
||||||
var escaped_json_from_object = escape(JSON.stringify({"name": {"LIKE":"Justin%", "!=":"Justin Walsh"}}));
|
|
@ -1,28 +0,0 @@
|
|||||||
To filter an api call, send the optional `sort` parameter. The sort parameter is a structured json object.
|
|
||||||
|
|
||||||
## Structure
|
|
||||||
|
|
||||||
The sort object is a simple `{"key": "direction"}` json object. The key is the field you wish to sort by. The direction is which order to sort the field by. The only two values you can use for the direction are `asc` and `desc`.
|
|
||||||
|
|
||||||
{
|
|
||||||
"field_key": "direction"
|
|
||||||
}
|
|
||||||
|
|
||||||
*Example Call:*
|
|
||||||
|
|
||||||
GET /collections/team?sort={"name":"asc"}
|
|
||||||
|
|
||||||
## Multiple Fields
|
|
||||||
|
|
||||||
This structure allows you to sort by more then one field at a time.
|
|
||||||
|
|
||||||
{
|
|
||||||
"field key": "direction",
|
|
||||||
"field key 2": "direction",
|
|
||||||
"field key 2": "direction"
|
|
||||||
...
|
|
||||||
}
|
|
||||||
|
|
||||||
*Example Call:*
|
|
||||||
|
|
||||||
GET /collections/team?sort={"age":"desc", "name":"asc"}
|
|
@ -1,17 +0,0 @@
|
|||||||
A config object that contains other objects (admin sections) and displays them in a group.
|
|
||||||
|
|
||||||
Parent elements are characterized by a subhead in the admin panel navigation. They also group elements in the [[Outline (call)]].
|
|
||||||
|
|
||||||
{
|
|
||||||
"sample_parent": {
|
|
||||||
"title": "Sample Parent",
|
|
||||||
"type": "parent"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Name | Default | Description |
|
|
||||||
| :------------- | :------------- | :------------- |
|
|
||||||
| title | required | Descriptive title of the object. This value will be used to identify the object in the admin panel sidebar navigation. Required field. |
|
|
||||||
| type | parent | Object identifier. Required, must be set to: 'parent' |
|
|
@ -1,20 +0,0 @@
|
|||||||
The Single object is created in the config.json file. This will create a single page that can be edited in the admin panel and displayed on the front end.
|
|
||||||
|
|
||||||
{
|
|
||||||
"single-name": {
|
|
||||||
"title": "single-title",
|
|
||||||
"parent": "sample_parent",
|
|
||||||
"type": "single",
|
|
||||||
"fields": {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
| Name | Default | Description |
|
|
||||||
| :------------- | :------------- | :------------- |
|
|
||||||
| title | required | Descriptive title of the page. This value will be used to identify the object in the admin panel sidebar navigation. Required field. |
|
|
||||||
| type | single | Object identifier. Required, must be set to: 'single.' |
|
|
||||||
| parent | - | Defines parent container object. Allows you to group multiple objects together in the admin panel (like a folder). |
|
|
||||||
| nav | true | Allows you to hide or show object elements in the admin panel. |
|
|
@ -1,45 +0,0 @@
|
|||||||
The Multiple object is created in the 'config.json' file. This will create a group of many pages (records) that can be edited in the admin panel and displayed on the front end.
|
|
||||||
|
|
||||||
{
|
|
||||||
"multiple-name": {
|
|
||||||
"title": "multiple-title",
|
|
||||||
"parent": "sample_parent",
|
|
||||||
"type": "multiple",
|
|
||||||
"fields": {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Name | Default | Options | Description |
|
|
||||||
| :------------- | :------------- | :------------- | :------------- |
|
|
||||||
| title | required | | Descriptive title of the object. This value will be used to identify the object in the admin panel sidebar navigation. Required field. |
|
|
||||||
| type | multiple | | Object identifier. Required, must be set to: 'multiple.' |
|
|
||||||
| parent | '' | | Defines parent container object. Allows you to group multiple objects together in the admin panel (like a folder). |
|
|
||||||
| nav | true | true,false | Allows you to hide or show object elements in the admin panel. |
|
|
||||||
| filters | '' | | Creates a select menu in the admin panel that will filter returned records. |
|
|
||||||
| sort | '' | asc, desc | Sorts records on call. |
|
|
||||||
| display | '' | | Defines values to display in the admin output table for each record. |
|
|
||||||
| download | true | true,false | Enables raw data download from admin panel. (csv file) |
|
|
||||||
| redirects | true | true,false | Enables option to create link (url) based records. |
|
|
||||||
| publish | true | true,false | Removes ability to save individual record as draft. |
|
|
||||||
|
|
||||||
## Filters Example
|
|
||||||
|
|
||||||
{
|
|
||||||
"filters": ["value"]
|
|
||||||
}
|
|
||||||
|
|
||||||
## Sort Example
|
|
||||||
{
|
|
||||||
"sort":{
|
|
||||||
"value":"asc"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
## Display Example
|
|
||||||
{
|
|
||||||
"display":["fname", "lname", "phone", "email"]
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
Creates a color picker field that will return a hex value through the API.
|
|
||||||
|
|
||||||
![TodayCMScolor picker](http://space.todaymade.com/todaycms/colorpicker2.jpg)
|
|
||||||
|
|
||||||
"color": {
|
|
||||||
"title": "Color Picker",
|
|
||||||
"type": "colorpicker"
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
Creates a single date field with a visual calendar drop down.
|
|
||||||
|
|
||||||
![Todaycms date field](http://space.todaymade.com/todaycms/date.jpg)
|
|
||||||
|
|
||||||
"date": {
|
|
||||||
"title": "Date Field",
|
|
||||||
"type": "date"
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
Creates a single date and time field with a visual drop down for each.
|
|
||||||
|
|
||||||
![todaycms date and time field](http://space.todaymade.com/todaycms/datetime.jpg)
|
|
||||||
|
|
||||||
"datetime": {
|
|
||||||
"title": "Date Time Field",
|
|
||||||
"type": "datetime"
|
|
||||||
}
|
|
||||||
|
|
||||||
Returns a single date/time value.
|
|
||||||
|
|
||||||
[datetime] => 01/16/2012 12:00 am
|
|
@ -1,9 +0,0 @@
|
|||||||
Creates a page divider with customizable text. Visible only from the CMS.
|
|
||||||
|
|
||||||
![todaycms divider field](http://space.todaymade.com/todaycms/divider.jpg)
|
|
||||||
|
|
||||||
"divider-1": {
|
|
||||||
"title": "Page Divider",
|
|
||||||
"type": "divider"
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
Creates a single file upload field.
|
|
||||||
|
|
||||||
![TodayCMS File](http://space.todaymade.com/todaycms/file.jpg)
|
|
||||||
|
|
||||||
"file": {
|
|
||||||
"title": "File Field",
|
|
||||||
"type": "file"
|
|
||||||
}
|
|
||||||
|
|
||||||
Returns an array.
|
|
||||||
|
|
||||||
[file] => Array
|
|
||||||
(
|
|
||||||
[caption] =>
|
|
||||||
[date] => 11/1/2012
|
|
||||||
[url] => http://todaycms.s3.amazonaws.com/...filename.pdf
|
|
||||||
[name] => filename.pdf
|
|
||||||
)
|
|
@ -1,21 +0,0 @@
|
|||||||
Creates multiple file upload fields with sort and caption options.
|
|
||||||
|
|
||||||
![todaycms files](http://space.todaymade.com/todaycms/files.jpg)
|
|
||||||
|
|
||||||
"files": {
|
|
||||||
"title": "Files Field",
|
|
||||||
"type": "files"
|
|
||||||
}
|
|
||||||
|
|
||||||
Returns a multidimensional array.
|
|
||||||
|
|
||||||
[files] => Array
|
|
||||||
(
|
|
||||||
[0] => Array
|
|
||||||
(
|
|
||||||
[caption] => Pre-Order Form
|
|
||||||
[date] => 2/13/2012
|
|
||||||
[url] => http://todaycms.s3.amazonaws.com/...filename.pdf
|
|
||||||
[name] => Author Visit - Beth McKinney.pdf
|
|
||||||
)
|
|
||||||
)
|
|
@ -1,28 +0,0 @@
|
|||||||
Creates an instance of the TodayCMS FormBuilder. This will allow end users to create complex forms with a variety of options for data collection and submission.
|
|
||||||
|
|
||||||
![TodayCMS Formbuilder](http://space.todaymade.com/todaycms/formbuilder.jpg)
|
|
||||||
|
|
||||||
"form": {
|
|
||||||
"title": "Form Builder",
|
|
||||||
"type": "formbuilder"
|
|
||||||
}
|
|
||||||
|
|
||||||
**Available Fields**
|
|
||||||
|
|
||||||
* Single Line Text
|
|
||||||
* Multiple Line Text
|
|
||||||
* Dropdown Select
|
|
||||||
* Checkbox Options
|
|
||||||
* Multiple Choice (Radio Buttons)
|
|
||||||
* Phone
|
|
||||||
* Email
|
|
||||||
|
|
||||||
**Form Actions**
|
|
||||||
|
|
||||||
* Redirect to another page
|
|
||||||
* Display a message
|
|
||||||
* Send to Paypal
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
See the [[Formbuilder (helper)]]
|
|
@ -1,40 +0,0 @@
|
|||||||
Creates a hidden form field.
|
|
||||||
|
|
||||||
"hidden": {
|
|
||||||
"title": "Hidden Field",
|
|
||||||
"type": "hidden",
|
|
||||||
}
|
|
||||||
|
|
||||||
"hidden-forced-value": {
|
|
||||||
"title": "Hidden Forced Value Field",
|
|
||||||
"type": "hidden",
|
|
||||||
"value": "Forced Value"
|
|
||||||
}
|
|
||||||
|
|
||||||
"hidden-default-value": {
|
|
||||||
"title": "Hidden Default Value Field",
|
|
||||||
"type": "hidden",
|
|
||||||
"default": "Default Value"
|
|
||||||
}
|
|
||||||
|
|
||||||
"hidden-timestamp-value": {
|
|
||||||
"title": "Hidden Timestamp Value Field",
|
|
||||||
"type": "hidden",
|
|
||||||
"default": "timestamp"
|
|
||||||
}
|
|
||||||
|
|
||||||
"hidden-display-value": {
|
|
||||||
"title": "Hidden Display Field",
|
|
||||||
"type": "hidden",
|
|
||||||
"value": "You should see this",
|
|
||||||
"display": true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Name | Default | Options | Description |
|
|
||||||
| ------------- | ------------- | ------------- | ------------- |
|
|
||||||
| default | '' | string, timestamp | Sets a default value for the hidden field. Timestamp will display current date/time. |
|
|
||||||
| display | false | true,false | Can see the value but can't change it |
|
|
||||||
| auto_increment | false | true, false | Creates unique id starting with 1. |
|
|
@ -1,53 +0,0 @@
|
|||||||
Creates a single image upload field.
|
|
||||||
|
|
||||||
![image](http://space.todaymade.com/todaycms/image-field.jpg)
|
|
||||||
|
|
||||||
"image": {
|
|
||||||
"title": "Image Field",
|
|
||||||
"type": "image",
|
|
||||||
"sizes": {
|
|
||||||
"thumb": {
|
|
||||||
"height": 150,
|
|
||||||
"width": 150,
|
|
||||||
"resize_strategy": "crop"
|
|
||||||
},
|
|
||||||
"large": {
|
|
||||||
"height": 500,
|
|
||||||
"width": 500,
|
|
||||||
"resize_strategy": "fit"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Image fields allows you to determine multiple thumbnail/image sizes and cropping techniques.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
|
||||||
| ------------- | ------------- | ------------- | ------------- |
|
|
||||||
| width | 1-5000 | Width of the input image | Width of the new image, in pixels |
|
|
||||||
| height | 1-5000 | Height of the input image | Height of the new image, in pixels |
|
|
||||||
| strip | boolean | false | Strips all metadata from the image. This is useful to keep thumbnails as small as possible. |
|
|
||||||
| flatten | boolean | true | Flattens all layers onto the specified background to achive better results from transparent formats to non-transparent formats, as explained in the [ImageMagick](http://www.imagemagick.org/script/command-line-options.php?#layers) documentation. **Important:** To preserve animations, GIF files are not flattened when this is set to true. To flatten GIF animations, use the frame parameter. |
|
|
||||||
| correct_gamma | boolean | false | Prevents gamma errors [common in many image scaling algorithms](http://www.4p8.com/eric.brasseur/gamma.html). |
|
|
||||||
| quality | 1-100 | Quality of the input image, or 92 | Controls the image compression for JPG and PNG images. |
|
|
||||||
| background | string | "#FFFFFF" | Either the hexadecimal code or [name](http://www.imagemagick.org/script/color.php#color_names) of the color used to fill the background (only used for the pad resize strategy). **Important:** By default, the background of transparent images is changed to white. For details about how to preserve transparency across all image types, see [this demo](https://transloadit.com/demos/image-resize/properly-preserve-transparency-across-all-image-types). |
|
|
||||||
| resize_strategy | string | "fit" | See [[Resize Strategies Table]] |
|
|
||||||
| zoom | boolean | true | If this is set to false, smaller images will not be stretched to the desired width and height. For details about the impact of zooming for your preferred resize strategy, see the [[Resize Strategies Table]]. |
|
|
||||||
| crop | { x1: integer, y1: integer, x2: integer, y2: integer } | {} | Specify an object containing coordinates for the top left and bottom right corners of the rectangle to be cropped from the original image(s). For example, `{x1: 80, y1: 100, x2: 160, y2: 180}` will crop the area from `(80,100)` to `(160,180)` which is a square whose width and height are 80px. If crop is set, the width and height parameters are ignored, and the resize_strategy is set to crop automatically. |
|
|
||||||
| format | string | Format of the input image | The available formats are `"jpg"`, `"png"`, `"gif"`, and `"tiff"`. |
|
|
||||||
| gravity | string | center | The direction from which the image is to be cropped. The available options are `"center"`, `"top"`, `"bottom"`, `"left"`, and `"right"`. You can also combine options with a hyphen, such as `"bottom-right"`. |
|
|
||||||
| frame | integer | null (all frames) | Use this parameter when dealing with animated GIF files to specify which frame of the GIF is used for the operation. Specify 1 to use the first frame, 2 to use the second, and so on. |
|
|
||||||
| colorspace | string | " " | Sets the image colorspace. For details about the available values, see the [ImageMagick documentation](http://www.imagemagick.org/script/command-line-options.php#colorspace). |
|
|
||||||
| rotation | string / boolean / integer | true | Determines whether the image should be rotated. Set this to true to auto-rotate images that are misrotated, or depend on EXIF rotation settings. You can also set this to an integer to specify the rotation in degrees. You can also specify degrees> to rotate only when the image width exceeds the height (or degrees< if the width must be less than the height). Specify false to disable auto-fixing of misrotated images. |
|
|
||||||
| compress | string | null | Specifies pixel compression for when the image is written. Valid values are None, `"BZip"`, `"Fax"`, `"Group4"`, `"JPEG"`, `"JPEG2000"`, `"Lossless"`, `"LZW"`, `"RLE"`, and `"Zip"`. Compression is disabled by default. |
|
|
||||||
| blur | string | null | Specifies gaussian blur, using a value with the form `{radius}x{sigma}`. The radius value specifies the size of area the operator should look at when spreading pixels, and should typically be either `"0"` or at least two times the sigma value. The sigma value is an approximation of how many pixels the image is "spread"; think of it as the size of the brush used to blur the image. This number is a floating point value, enabling small values like `"0.5"` to be used. For details about how the radius and sigma values affect blurring, see [this example](http://www.imagemagick.org/Usage/blur/blur_montage.jpg). |
|
|
||||||
|
|
||||||
**Watermark Parameters**
|
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
|
||||||
| ------------- | ------------- | ------------- | ------------- |
|
|
||||||
| watermark_url | string | " " | A url indicating a PNG image to be overlaid above this image. |
|
|
||||||
| watermark_position | string/array | "center" | The position at which the watermark is placed. The available options are `"center"`, `"top"`, `"bottom"`, `"left"`, and `"right"`. You can also combine options, such as `"bottom-right"`. An array of possible values can also be specified, in which case one value will be selected at random, such as `["center","left","bottom-left","bottom-right"]`. _Note that this setting puts the watermark in the specified corner. To use a specific pixel offset for the watermark, you will need to add the padding to the image itself._ |
|
|
||||||
| watermark_size | string | "" | The size of the watermark, as a percentage. For example, a value of `"50%"` means that size of the watermark will be 50% of the size of image on which it is placed. |
|
|
||||||
| watermark_resize_strategy | string | "fit" | Available values are `"fit"` and `"stretch"`. |
|
|
@ -1,24 +0,0 @@
|
|||||||
Creates a multi image upload field. Useful for a gallery or rotating image.
|
|
||||||
|
|
||||||
![images](http://space.todaymade.com/todaycms/images.jpeg)
|
|
||||||
|
|
||||||
"images": {
|
|
||||||
"title": "Images Field",
|
|
||||||
"type": "images",
|
|
||||||
"sizes": {
|
|
||||||
"thumb": {
|
|
||||||
"height": 150,
|
|
||||||
"width": 150,
|
|
||||||
"resize_strategy": "crop"
|
|
||||||
},
|
|
||||||
"large": {
|
|
||||||
"height": 500,
|
|
||||||
"width": 500,
|
|
||||||
"resize_strategy": "crop"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
See [parameters table](https://github.com/justinwalsh/todaycms/wiki/Image).
|
|
||||||
|
|
||||||
See [resize strategies table](https://github.com/justinwalsh/todaycms/wiki/Resize-Strategies-Table).
|
|
@ -1,8 +0,0 @@
|
|||||||
Creates an instance of the markItUp! universal markup editor. Editor allows easy access to HTML editing.
|
|
||||||
|
|
||||||
![MarkItUp! editor](http://space.todaymade.com/todaycms/markitup.jpeg)
|
|
||||||
|
|
||||||
"markitup": {
|
|
||||||
"title":"Markitup",
|
|
||||||
"type":"markitup"
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
Creates a repeatable object that can utilize all TodayCMS field types.
|
|
||||||
|
|
||||||
![Multi Field](http://space.todaymade.com/todaycms/multi.jpeg)
|
|
||||||
|
|
||||||
"multi": {
|
|
||||||
"title": "Multi Field",
|
|
||||||
"display": "title",
|
|
||||||
"type": "multi",
|
|
||||||
"fields": {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Name | Default | Options | Description |
|
|
||||||
| ------------- | ------------- | ------------- | ------------- |
|
|
||||||
| display | '' | | Field name to use as the identifier in the title cell. |
|
|
@ -1,45 +0,0 @@
|
|||||||
Creates a form field type that allows the selection of one or more items from a dropdown list.
|
|
||||||
|
|
||||||
![multi select static](http://space.todaymade.com/todaycms/multi-select-static.jpg)
|
|
||||||
|
|
||||||
### Static Options
|
|
||||||
Displays a static list of options.
|
|
||||||
|
|
||||||
"multiselect": {
|
|
||||||
"title": "Multi Select - Static",
|
|
||||||
"type": "multiselect",
|
|
||||||
"options": {
|
|
||||||
"value": "Display Name",
|
|
||||||
"value2": "Display Name 2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
### Reference Options
|
|
||||||
Displays the records from another object in the config. This is commonly used to create multiple relational data associations.
|
|
||||||
|
|
||||||
"referenced-object": {
|
|
||||||
"title": "Referenced Object",
|
|
||||||
"type": "multiple",
|
|
||||||
"fields": {
|
|
||||||
"name": {
|
|
||||||
"title": "Record Name",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"multiselect": {
|
|
||||||
"title": "Multi Select - Reference",
|
|
||||||
"type": "multiselect",
|
|
||||||
"options": "referenced-object",
|
|
||||||
"display": "name"
|
|
||||||
}
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Name | Default | Options | Description |
|
|
||||||
| ------------- | ------------- | ------------- | ------------- |
|
|
||||||
| options | '' | | A list of values (object), or reference name for another object in the config. |
|
|
||||||
| display | '' | | Field name to use as the identifier in the dropdown select |
|
|
||||||
|
|
||||||
See also [[Select]].
|
|
@ -1,8 +0,0 @@
|
|||||||
Creates a password form field.
|
|
||||||
|
|
||||||
![password](http://space.todaymade.com/todaycms/password.jpg)
|
|
||||||
|
|
||||||
"password": {
|
|
||||||
"title": "Password Field",
|
|
||||||
"type": "password"
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
Creates a form field type that allows the selection of a single item from a dropdown list.
|
|
||||||
|
|
||||||
![static field](http://space.todaymade.com/todaycms/select.jpg)
|
|
||||||
|
|
||||||
### Static Options
|
|
||||||
Displays a static list of options.
|
|
||||||
|
|
||||||
"select": {
|
|
||||||
"title": "Select Field - Static Options",
|
|
||||||
"type": "select",
|
|
||||||
"options": {
|
|
||||||
"value1": "Display Name One",
|
|
||||||
"value2": "Display Name Two",
|
|
||||||
"value3": "Display Name Three"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
### Reference Options
|
|
||||||
Displays a list of the records from another object in the config. This is commonly used to create relational data association. For example, a list of categories or a grouping.
|
|
||||||
|
|
||||||
"referenced-object": {
|
|
||||||
"title": "Referenced Object",
|
|
||||||
"type": "multiple",
|
|
||||||
"fields": {
|
|
||||||
"name": {
|
|
||||||
"title": "Record Name",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"select-reference": {
|
|
||||||
"title": "Select Field - Reference",
|
|
||||||
"type": "select",
|
|
||||||
"options": "referenced-object",
|
|
||||||
"display": "name"
|
|
||||||
}
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Name | Default | Options | Description |
|
|
||||||
| ------------- | ------------- | ------------- | ------------- |
|
|
||||||
| options | '' | | A list of values (object), or reference name for another object in the config. |
|
|
||||||
| display | '' | | Field name to use as the identifier in the dropdown select |
|
|
||||||
| blank | '' | string | String uses for the default dropdown select option. Value is set to null. |
|
|
||||||
| hidden | false | true, false | Hides the select menu and passes a value through as a hidden field. |
|
|
||||||
| value | | | Sets a default value. |
|
|
||||||
|
|
||||||
See also [[Multiselect]].
|
|
@ -1,8 +0,0 @@
|
|||||||
Creates a text form field.
|
|
||||||
|
|
||||||
![text ](http://space.todaymade.com/todaycms/text.jpg)
|
|
||||||
|
|
||||||
"text": {
|
|
||||||
"title": "Text Field",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
Creates a textarea form field.
|
|
||||||
|
|
||||||
![Textarea](http://space.todaymade.com/todaycms/textarea.jpg)
|
|
||||||
|
|
||||||
"textarea": {
|
|
||||||
"title": "Wysiwyg Field",
|
|
||||||
"type": "textarea"
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
Creates a WYSIWYG textarea form field.
|
|
||||||
|
|
||||||
![WYSIWYG](http://space.todaymade.com/todaycms/wysiwyg.jpg)
|
|
||||||
|
|
||||||
"wysiwyg": {
|
|
||||||
"title": "Wysiwyg Field",
|
|
||||||
"type": "wysiwyg"
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
To create an editor on a page use the following code
|
|
||||||
|
|
||||||
<div id="cms-editor"></div>
|
|
||||||
<script type="text/javascript" src="dist/js/todaycms.js"></script>
|
|
||||||
<script type='text/javascript'>
|
|
||||||
cms_setup({
|
|
||||||
apikey: '7DdPrtGp9ZhKmk',
|
|
||||||
collection: "listings"
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
***Required***: 'apikey' and 'collection' are required parameters for the editor to load.
|
|
@ -1,71 +0,0 @@
|
|||||||
There are several customizations that can be made to the 'cms_setup' function.
|
|
||||||
|
|
||||||
##id
|
|
||||||
Used to update an existing record.
|
|
||||||
|
|
||||||
<script type='text/javascript'>
|
|
||||||
cms_setup({
|
|
||||||
apikey: '7DdPrtGp9ZhKmk',
|
|
||||||
collection: "listings",
|
|
||||||
id: 12345
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
##config
|
|
||||||
Overrides the collections configuration for only this editor.
|
|
||||||
|
|
||||||
In this example we are changing the visibility of the account field:
|
|
||||||
|
|
||||||
<script type='text/javascript'>
|
|
||||||
cms_setup({
|
|
||||||
apikey: '7DdPrtGp9ZhKmk',
|
|
||||||
collection: "listings",
|
|
||||||
config: {
|
|
||||||
fields: {
|
|
||||||
account: {
|
|
||||||
hidden:true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
##data
|
|
||||||
Overrides the data for this object
|
|
||||||
|
|
||||||
<script type='text/javascript'>
|
|
||||||
cms_setup({
|
|
||||||
apikey: '7DdPrtGp9ZhKmk',
|
|
||||||
collection: "listings",
|
|
||||||
data: {
|
|
||||||
account: 12345
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
##callbacks
|
|
||||||
[Learn more](/Editor/Callbacks) about callbacks you can use to hook into the processing of the editor.
|
|
||||||
|
|
||||||
##bootstrap
|
|
||||||
Enable or disable the bootstrap css. Useful if bootstrap has already been loaded on the page.
|
|
||||||
|
|
||||||
<script type='text/javascript'>
|
|
||||||
cms_setup({
|
|
||||||
apikey: '7DdPrtGp9ZhKmk',
|
|
||||||
collection: "listings",
|
|
||||||
bootstrap: false
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
##theme
|
|
||||||
Sets the theme. Availible themes: light or dark. The light theme is the default. Use false to disable the theme css.
|
|
||||||
|
|
||||||
<script type='text/javascript'>
|
|
||||||
cms_setup({
|
|
||||||
apikey: '7DdPrtGp9ZhKmk',
|
|
||||||
collection: "listings",
|
|
||||||
theme: false,
|
|
||||||
// or
|
|
||||||
// theme: 'dark'
|
|
||||||
});
|
|
||||||
</script>
|
|
@ -1,73 +0,0 @@
|
|||||||
There are several callbacks availible to hook into the editors processing.
|
|
||||||
|
|
||||||
## Structure
|
|
||||||
|
|
||||||
All callbacks use the same basic structure:
|
|
||||||
|
|
||||||
<script type='text/javascript'>
|
|
||||||
cms_setup({
|
|
||||||
apikey: '7DdPrtGp9ZhKmk',
|
|
||||||
collection: "listings",
|
|
||||||
before_save: function(object, next) {
|
|
||||||
if (object.first_name === '' || object.first_name === undefined) {
|
|
||||||
alert('Please enter a first name.');
|
|
||||||
next(false);
|
|
||||||
} else {
|
|
||||||
next(object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
A callback must accept these two parameters:
|
|
||||||
|
|
||||||
`object` - a copy of the data that is about to be saved, or was just saved.
|
|
||||||
`next` - a function that must be called after your code is finished to continue processing the request.
|
|
||||||
|
|
||||||
You must with call `next(object);` to continue or `next(false);` to cancel the request.
|
|
||||||
|
|
||||||
## Before Callbacks
|
|
||||||
|
|
||||||
Before callbacks are fired before anything is sent to the server to be saved. Use these callbacks to valid user imput, or load remote data and merge it into the object before saving. You can cancel the save completly by calling `next(false);`
|
|
||||||
|
|
||||||
| Name | On | Description |
|
|
||||||
| :--- | :--- | :--- |
|
|
||||||
| before_create | create | Called before creating a new object in a collection. |
|
|
||||||
| before_update | update | Called before updating an existing object in a collection. |
|
|
||||||
| before_save | create or update | Called before saving any object in a collection. |
|
|
||||||
|
|
||||||
## After Callbacks
|
|
||||||
|
|
||||||
Once the data has been saved to the server, use after callbacks to trigger any other actions you need to happen. An example might be sending a welcome email when someone creates a new object. You can no longer cancel the save, but you can stop further callbacks from executing by calling `next(false);`
|
|
||||||
|
|
||||||
| Name | On | Description |
|
|
||||||
| :--- | :--- | :--- |
|
|
||||||
| after_create | create | Called after creating a new object in a collection. |
|
|
||||||
| after_update | update | Called after updating an existing object in a collection. |
|
|
||||||
| after_save | create or update | Called after saving any object in a collection. |
|
|
||||||
|
|
||||||
## Multiple Callbacks
|
|
||||||
|
|
||||||
You can use several callbacks together, just remember to call `next(object);` to continue the chain.
|
|
||||||
|
|
||||||
## Firing Order
|
|
||||||
|
|
||||||
Callbacks are fired in a specific order. Here is a breakdown of each possible chain.
|
|
||||||
|
|
||||||
**Creating New Object:**
|
|
||||||
|
|
||||||
1. before_create
|
|
||||||
1. before_save
|
|
||||||
1. [saves]
|
|
||||||
1. after_create
|
|
||||||
1. after_save
|
|
||||||
|
|
||||||
**Saving Existing Object:**
|
|
||||||
|
|
||||||
1. before_update
|
|
||||||
1. before_save
|
|
||||||
1. [saves]
|
|
||||||
1. after_update
|
|
||||||
1. after_save
|
|
@ -1,3 +0,0 @@
|
|||||||
The PHP SDK is a file called `connector.php` that makes it easier to work with the API. It contains helpers and functions that map to API calls.
|
|
||||||
|
|
||||||
Receive your unique API key details from [Todaymade] (http://todaymade.com/contact).
|
|
@ -1,10 +0,0 @@
|
|||||||
Create (or add) the 'config.json' and 'connector.php' files to the root of your website.
|
|
||||||
|
|
||||||
The connector.php file is the root of the CMS's power. To create a connection to the API server, include the connector.php file and create an instance of the Todaycms class using php.
|
|
||||||
|
|
||||||
```php
|
|
||||||
<?php include($_SERVER["DOCUMENT_ROOT"]."/connector.php");
|
|
||||||
$cms = new Todaycms('API_KEY_HERE'); ?>
|
|
||||||
```
|
|
||||||
|
|
||||||
The $cms variable is now availible to start making calls to the api
|
|
@ -1,3 +0,0 @@
|
|||||||
To debug your api calls and to find out what data is available to your page. Add '?debug' to the ending of any url.
|
|
||||||
|
|
||||||
http://yourdomain.com?debug
|
|
@ -1,9 +0,0 @@
|
|||||||
Returns the config object that is assosicated with the current API key.
|
|
||||||
|
|
||||||
To retreive the config simply use the $cms variable:
|
|
||||||
|
|
||||||
$config = $cms->config();
|
|
||||||
|
|
||||||
You can also filter your config to a specific collection.
|
|
||||||
|
|
||||||
$team_config = $cms->config("team");
|
|
@ -1,13 +0,0 @@
|
|||||||
Single is the heart of any website. It represents a single record in the CMS system.
|
|
||||||
|
|
||||||
To make a call to the api simply use the $cms variable:
|
|
||||||
|
|
||||||
$page = $cms->key("OBJECT-NAME")->single();
|
|
||||||
|
|
||||||
Call a single record by ID
|
|
||||||
|
|
||||||
$cms->key(1234)->single();
|
|
||||||
|
|
||||||
Call a single record by slug
|
|
||||||
|
|
||||||
$cms->parent(key)->slug(about-us)->single();
|
|
@ -1,9 +0,0 @@
|
|||||||
Multiple objects represent a group of records in the CMS system.
|
|
||||||
|
|
||||||
To make a call to the api simply use the $cms variable:
|
|
||||||
|
|
||||||
$pages = $cms->key("OBJECT-NAME")->multiple();
|
|
||||||
|
|
||||||
You can also filter your results base field name.
|
|
||||||
|
|
||||||
$pages = $cms->key("OBJECT-NAME")->filter(FIELD-NAME, FIELD-VALUE)->multiple();
|
|
@ -1,9 +0,0 @@
|
|||||||
Count() will return the number of objects in a collection that match your query.
|
|
||||||
|
|
||||||
To call the API, use the $cms variable and provide the count() method with a collection name:
|
|
||||||
|
|
||||||
$count = $cms->count('listings');
|
|
||||||
|
|
||||||
This can be used in conjuction with filters:
|
|
||||||
|
|
||||||
$count = $cms->filter(array('account' => '25'))->count('listings');
|
|
@ -1,13 +0,0 @@
|
|||||||
Sort allows a Multiple() query to return objects from a collection in a desired order.
|
|
||||||
|
|
||||||
The sort() method accepts an array or JSON string of field types and order direction ("asc" or "desc").
|
|
||||||
|
|
||||||
$listings = $cms->sort(array('state' => 'asc', 'name' => 'asc'))->multiple('listings');
|
|
||||||
|
|
||||||
$listings = $cms->sort("{'state':'asc', 'name':'asc'}")->multiple('listings');
|
|
||||||
|
|
||||||
Sort() can also be used in conjuction with filters to finely control query output.
|
|
||||||
|
|
||||||
$listings = $cms->sort(array('state' => 'asc', 'name' => 'asc'))->filter(array('account_id' => '25'))->multiple('listings');
|
|
||||||
|
|
||||||
$listings = $cms->sort("{'state':'asc', 'name':'asc'}")->filter("{'account_id':'25')}")->multiple('listings');
|
|
@ -1,9 +0,0 @@
|
|||||||
Filter can be used in conjuction with a Single() or Multiple() query to find specific records in a collection. Applying a filter will allow a query to return records in the collection with matching field values.
|
|
||||||
|
|
||||||
An associative array or JSON string can be passed to the filter:
|
|
||||||
|
|
||||||
$listing = $cms->filter(array('account_id' => '25'))->multiple('listings');
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
$listing = $cms->filter("{'account_id':'25'}")->multiple('listings');
|
|
@ -1,5 +0,0 @@
|
|||||||
object **id** ( int *$id* )
|
|
||||||
|
|
||||||
Slug() provides shorthand filtering in conjunction with Single(). It will match the collection object with the specified id parameter.
|
|
||||||
|
|
||||||
$listing = $cms->id(4775)->single('listings');
|
|
@ -1,6 +0,0 @@
|
|||||||
object **slug** ( string *$slug* )
|
|
||||||
|
|
||||||
Slug() provides shorthand filtering in conjunction with Single(). It will match the collection object with the specified slug parameter.
|
|
||||||
|
|
||||||
$listing = $cms->slug('listing-5')->single('listings');
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
object **param** ( string *$key*, string *$value* )
|
|
||||||
|
|
||||||
Param() privides a means of adding arbitrary parameters to a TodayCMS API call.
|
|
||||||
|
|
||||||
$cms->param('overwrite', true);
|
|
@ -1,17 +0,0 @@
|
|||||||
Read() provides a means for Single() and Multiple() to interface with the TodayCMS API and query the API for objects from a specified collection. query the API for objects from a specified collection.
|
|
||||||
|
|
||||||
$listings = $cms->read('listings');
|
|
||||||
// returns all objects from the 'listings' collection
|
|
||||||
|
|
||||||
It can be used in conjunction with Sort() and Filter() to provide fine control over query results.
|
|
||||||
|
|
||||||
$listings1 = $cms->sort(array('name':'asc'))->multiple('listings');
|
|
||||||
// returns all objects from the 'listings' collection, sorted in ascending order by 'name'
|
|
||||||
|
|
||||||
$listings2 = $cms->filter(array('account_id':'25'))->multiple('listings');
|
|
||||||
// returns all objects from the 'listings' collection with an 'account_id' matching '25'
|
|
||||||
|
|
||||||
It can be used in conjuction with 'limit' and 'offset' parameters to determine the maximum number of results and paging.
|
|
||||||
|
|
||||||
$listings = $cms->param('limit', 15)->param('offset', 2)->multiple('listings');
|
|
||||||
// returns 15 objects from the second page of results, or objects 16-30
|
|
@ -1,5 +0,0 @@
|
|||||||
Create() provides a means of interfacing with the TodayCMS API to create a new object in a specified collection.
|
|
||||||
|
|
||||||
$listing = $cms->create('listings', array('name' => 'Listing Name', 'account_id' => '25'));
|
|
||||||
|
|
||||||
Returns an associative array of the new object or false.
|
|
@ -1,17 +0,0 @@
|
|||||||
Update() provides a means of interfacing with the TodayCMS API to update an object or group of objects in a specified collection.
|
|
||||||
|
|
||||||
Update() must be used in conjunction with Filter(). An empty filter object will allow Update() to modify all objects in the collection; otherwise, all objects matching the filter object parameters will be modified.
|
|
||||||
|
|
||||||
To modify all objects in a collection:
|
|
||||||
|
|
||||||
$listing = $cms->filter()->update('listings', array('name' => 'Listing Name', 'account_id' => '25'));
|
|
||||||
|
|
||||||
To modify a subset of objects in a collection:
|
|
||||||
|
|
||||||
$listing = $cms->filter(array('state' => 'ND'))->update('listings', array('name' => 'Listing Name', 'account_id' => '25'));
|
|
||||||
|
|
||||||
By default, Update() will merge data with the existing data in the object. If you wish to overwrite all data in the object with the newly provided data, you must set the 'overwrite' parameter to 'true'.
|
|
||||||
|
|
||||||
$listing = $cms->param('overwrite', true)->filter()->update('listings', array('name' => 'Listing Name', 'account_id' => '25'));
|
|
||||||
|
|
||||||
Returns an associative array of the new object or false.
|
|
@ -1,15 +0,0 @@
|
|||||||
array **delete** ( string *$collection* )
|
|
||||||
|
|
||||||
Delete() provides a means of interfacing with the TodayCMS API to delete an object or group of objects in a specified collection.
|
|
||||||
|
|
||||||
Delete() must be used in conjunction with Filter(). An empty filter object will allow Delete() to remove all objects in the collection; otherwise, all objects matching the filter object parameters will be removed from the datastore.
|
|
||||||
|
|
||||||
To delete all objects in a collection:
|
|
||||||
|
|
||||||
$listing = $cms->filter()->delete('listings');
|
|
||||||
|
|
||||||
To delete a subset of objects in a collection:
|
|
||||||
|
|
||||||
$listing = $cms->filter(array('state' => 'ND'))->delete('listings');
|
|
||||||
|
|
||||||
Returns an associative array of the new object or false.
|
|
@ -1,9 +0,0 @@
|
|||||||
string **get_api_url** ( string *$collection* )
|
|
||||||
|
|
||||||
Get_Api_Url() is a helper method for accessing the current construction of the TodayCMS API call url. It returns the full path to the API along with the api key and all parameters that have been attached with Param(), Sort(), Filter(), Slug(), and Id().
|
|
||||||
|
|
||||||
$listing = $cms->param('overwrite', true)->id(25));
|
|
||||||
|
|
||||||
$url = $cms->get_api_url('listings');
|
|
||||||
// 'http://path.to.api/collections/listings/25?_tokens&overwrite=true'
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
This helper was added to the connector.php file, version 2.*. It is designed to display a fully-functioning AJAX web form with validation built in.
|
|
||||||
|
|
||||||
```php
|
|
||||||
<? if (isset($page['fields']['form'])) {
|
|
||||||
$cms->formbuilder($page['fields']['form'], $page);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
```
|
|
||||||
|
|
||||||
Returns: HTML/JS
|
|
@ -1,38 +0,0 @@
|
|||||||
object **latlng** ( int *$lat*, int *$lng* )
|
|
||||||
|
|
||||||
Sets the latitude and longitude of the Map object.
|
|
||||||
|
|
||||||
$map->latlng(40.11, -100.20);
|
|
||||||
|
|
||||||
object **height** ( string *$height* )
|
|
||||||
|
|
||||||
Sets the max-height of the Map object in 'px' or '%'.
|
|
||||||
|
|
||||||
$map1->height('400px');
|
|
||||||
$map2->height('100%');
|
|
||||||
|
|
||||||
object **width** ( string *$width* )
|
|
||||||
|
|
||||||
Sets the max-width of the Map object in 'px' or '%'.
|
|
||||||
|
|
||||||
$map1->width('400px');
|
|
||||||
$map2->width('100%');
|
|
||||||
|
|
||||||
object **infoWindow** ( string *$content* )
|
|
||||||
|
|
||||||
Sets the content of the infoWindow displayed in the embeddable Map object.
|
|
||||||
|
|
||||||
$map->infoWindow('Hello World!');
|
|
||||||
|
|
||||||
object **infoWindowMaxWidth** ( string *$maxwidth* )
|
|
||||||
|
|
||||||
Sets the max-width of the Map object in 'px' or '%'.
|
|
||||||
|
|
||||||
$map1->width('400px');
|
|
||||||
$map2->width('100%');
|
|
||||||
|
|
||||||
string **render** ( *void* )
|
|
||||||
|
|
||||||
$map->render();
|
|
||||||
|
|
||||||
Renders Map object into an embeddable string that displays a Google Map on the webpage.
|
|
@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
The Map object can be initialized with a latitude and longitude:
|
|
||||||
|
|
||||||
$map1 = new Map(40.11, -100.20);
|
|
||||||
$map1->render();
|
|
||||||
|
|
||||||
Alternatively, you can add properties to the Map with various setter Methods.
|
|
||||||
|
|
||||||
$map2 = new Map();
|
|
||||||
$map2->latlng(40.11, -100.20)->width('640px')->height('480px')->infoWindow('Hello World!')->render();
|
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"title": "TodayCMS Documentation",
|
|
||||||
"homepage": "/Getting_Started",
|
|
||||||
"theme": "simplex",
|
|
||||||
"hightlight": "dark",
|
|
||||||
"twitter": ["todaymade"],
|
|
||||||
"links": {
|
|
||||||
"Todaymade": "http://todaymade.com",
|
|
||||||
"Help/Support": "http://todaymade.com/contact",
|
|
||||||
"Submit a Bug": "https://github.com/justinwalsh/todaycms-docs/issues"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"title": "DAUX.IO",
|
"title": "DAUX.IO",
|
||||||
"tagline": "The Easiest Way To Document Your App",
|
"tagline": "The Easiest Way To Document Your Project",
|
||||||
"image": "/img/app.png",
|
"image": "/img/app.png",
|
||||||
"theme": "navy",
|
"theme": "navy",
|
||||||
"float": false,
|
"float": false,
|
||||||
|
Loading…
Reference in New Issue
Block a user