The @article file

Updated Jun 11, 2013

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 Neutral template that ships with ScreenSteps. As you can see, it is a mixture of HTML and PHP (the PHP code is highlighted).

  • 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 objects available to the @article file depend on whether an individual article is being exported or an entire manual.

An individual article

If an individual article is being exported then the $article object will be available to PHP. Here is what that object looks like:

stdClass Object
(
    [title] => The title of the atricle.
    [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 be be present when set to runs.
    [draft] => 1 or 0.
    [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.
                    [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.
                    [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.
                                    [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.
                                    [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.
                )
        )

)

An article that is part of a manual

If a manual is being exported then three additional objects are available: $manual, $links, and $counter.

For a description of the $manual object please refer to this article.

The $links object contains the link back to the table of contents file:

stdClass Object
(
    [tofc] => The link to the table of contents file.
)

The $counter object contains information about the number of articles and the number of the current article relative to all articles in the manual:

stdClass Object
(
    [chapters] => stdClass Object
        (
            [count] => The number of chapters in the manual.
        )
    [article] => stdClass Object
        (
            [index] => The article number (1-based).
        )
    [articles] => stdClass Object
        (
            [count] => The number of articles in the manual.
        )
)

0 Comment

Add your comment

E-Mail me when someone replies to this comment
Previous Article Possible values for text run arrays
Next Article The @tofc file

Still Need Help?

Contact Us