- Symphony 2.3
-
› assets
8 -
› boot
9 -
› core
22 -
› email-gateways
3 -
› global
34 -
› interface
1 -
› toolkit
69 - Delegates89
- Deprecated27
Versions
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.3
- 2.7.2
- 2.7.10
- 2.7.1
- 2.7.0
- 2.6.9
- 2.6.8
- 2.6.7
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.11
- 2.6.10
- 2.6.1
- 2.6.0
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2
Options
public class DataSource
class.datasource.php #21The Datasource class provides functionality to mainly process any parameters
that the fields will use in filters find the relevant Entries and return these Entries
data as XML so that XSLT can be applied on it to create your website. In Symphony,
there are four Datasource types provided, Section, Author, Navigation and Dynamic
XML. Section is the mostly commonly used Datasource, which allows the filtering
and searching for Entries in a Section to be returned as XML. Navigation datasources
expose the Symphony Navigation structure of the Pages in the installation. Authors
expose the Symphony Authors that are registered as users of the backend. Finally,
the Dynamic XML datasource allows XML pages to be retrieved. This is especially
helpful for working with Restful XML API's. Datasources are saved through the
Symphony backend, which uses a Datasource template defined in
TEMPLATE . /datasource.tpl
.
Methods
void __construct(
$env, $process_params)
Constructor for the datasource sets the parent, if $process_params
is set,
the $env
variable will be run through Datasource::processParameters
.
Parameters
See Also
DS_FILTER_OR __determineFilterType(
$value)
By default, all Symphony filters are considering to be AND filters, that is they are all used and Entries must match each filter to be included. It is possible to use OR filtering in a field by using an + to separate the values. eg. If the filter is test1 + test2, this will match any entries where this field is test1 OR test2. This function is run on each filter (ie. each field) in a datasource
Parameters
Returns
or DSFILTERAND
XMLElement __noRecordsFound()
Returns an error XMLElement with 'No records found' text
string __processParametersInString(
$value, $env, $includeParenthesis, $escape)
This function will replace any parameters in a string with their value. Parameters are defined by being prefixed by a $ character. In certain situations, the parameter will be surrounded by {}, which Symphony takes to mean, evaluate this parameter to a value, other times it will be omitted which is usually used to indicate that this parameter exists
Parameters
Returns
The string will all parameters evaluated. If a parameter was not found, it will not be replaced at all.
array about()
Returns an associative array of information about a datasource.
boolean allowEditorToParse()
This function is required in order to edit it in the datasource editor page.
Do not overload this function if you are creating a custom datasource. It is only
used by the datasource editor. If this is set to false, which is default, the
Datasource's about()
information will be displayed.
Returns
True if the Datasource can be edited, false otherwise. Defaults to false
XMLElement emptyXMLSet(XMLElement $xml)
If there is no results to return this function calls Datasource::__noRecordsFound
which appends an XMLElement to the current root element.
Parameters
static string escapeCommas(
$string)
Using regexp, this escapes any commas in the given string
Parameters
static mixed findParameterInEnv(
$needle, $env)
Parameters can exist in three different facets of Symphony; in the URL, in the parameter pool or as an Symphony param. This function will attempt to find a parameter in those three areas and return the value. If it is not found null is returned
Parameters
Returns
If the value is not found, null, otherwise a string or an array is returned
array getDependencies()
Accessor function to return this Datasource's dependencies
mixed getSource()
This function is required in order to identify what section this Datasource is for. It is used in the datasource editor. It must remain intact. Do not overload this function in custom events. Other datasources may return a string here defining their datasource type when they do not query a section.
XMLElement grab(
$param_pool)
The meat of the Datasource, this function includes the datasource type's file that will preform the logic to return the data for this datasource It is passed the current parameters.
Parameters
Returns
The XMLElement to add into the XML for a page.
string parseParamURL(
$url)
This function will parse a string (usually a URL) and fully evaluate any parameters (defined by {$param}) to return the absolute string value.
Parameters
Returns
The parsed URL
void processParameters(
$env)
This function will iterates over the filters and replace any parameters with their actual values. All other Datasource variables such as sorting, ordering and pagination variables are also set by this function
Parameters
static string removeEscapedCommas(
$string)
Used in conjunction with escapeCommas, this function will remove the escaping pattern applied to the string (and commas)