The @article file
The @article template file is processed by PHP and will generate the content for each article that you are exporting.
An example
Here is the @article.html for the Black & White template that ships with Clarify. As you can see, it is a mixture of HTML and PHP. The document content and user settings are all available as PHP objects that can be used to generate the output. For example:
- PHP is used to print the article title. If a meta title has been set then the meta title is used.
- The article title is added to the document. This is the title the user sees on the browser page.
- Article content is printed out using a function from helpers.php.
Which PHP objects are available to the @article file?
The following variables are available in the file:
- $article: The article content.
- $userSettings: Settings the user has configured.
- $output_filename: The name of the file that the template output is being saved to.
$article object (hierarchal)
stdClass Object
(
[title] => The title of the article.
[title_websafe] => The websafe version of the article title. Safe for use in a URL.
[description] => The article description.
[description_plain] => The article description with no formatting applied. This only applies if text_format is set to xhtml. It will not be present when set to runs.
[id] => An integer.
[meta_description] => The meta description assigned to the article.
[meta_search] => The meta search assigned to the article.
[meta_title] => The meta title assigned to the article.
[tag_list] => A comma delimited list of tags assigned to the article.
[tags] => Array
(
[0] => Tag name.
)
[steps] => Array
(
[0] => stdClass Object
(
[id] => An integer.
[anchor_name] => The step anchor name.
[instructions] => The step instructions.
[instructions_plain] => The step instructions with no formatting applied. This only applies if text_format is set to xhtml. It will be be present when set to runs.
[instructions_position] => 'above' or 'below'.
[level] => 1 or 2. 2 means the step is a sub-step of the preceding step. This is useful if the HTML template article_structure property is set to 'flat'.
[media] => stdClass Object
(
[fullsize] => stdClass Object
(
[type] => image'.
[filename] => The full path to the step image.
[relative_filename] => The relative path to the step image.
[url] => If the template is being used to publish to a service like WordPress then this is the URL where the image is located.
[width] => The width of the image in pixels.
[height] => The height of the image in pixels.
)
[thumbnail] =>
(
[type] => image'.
[filename] => The full path to the step thumbnail image.
[relative_filename] => The relative path to the step thumbnail image.
[url] => If the template is being used to publish to a service like WordPress then this is the URL where the image is located.
[height] => The height of the image in pixels.
[width] => The width of the image in pixels.
)
[type] => 'image' or 'html'.
[url_for_nonhtml] =>
[html] => If 'type' is 'html' then this contains the HTML for the step.
)
[media_alt] => The alternate tag for the media.
[title] => The step title.
[title_websafe] => The websafe version of the step title. Safe for use in a URL.
[uuid] => The UUID of the step.
[substep] => Array: this is only present if the HTML template article_structure property is set to 'hierarchal' (default).
(
[0] => stdClass Object
(
same structure as a step...
)
)
)
$userSettings object
stdClass Object
(
[footer_text] => The text the use wants to display in the footer.
[logo] => The path to the logo file the user selected.
)
0 Comments
Add your comment