Created
January 23, 2013 13:53
-
-
Save magnetised/4605834 to your computer and use it in GitHub Desktop.
An example of a content type with multiple outputs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IntegratedPage < Page | |
# Define multiple outputs for this page. Each one will be accessible by adding | |
# the relevant extension to the page's URL. e.g. | |
# /my-page => HTML | |
# /my-page.xml => XML | |
# /my-page.rss => RSS | |
outputs :html, :rss, :json, :xml | |
# If the output specified doesn't map to the extension of a a known MIME type | |
# then you can define the format manually. | |
# /my-page.mobile => HTML | |
# /my-page.custom => Plain text | |
add_output :mobile, :format => :html | |
add_output :custom, :mimetype => "text/plain" | |
# We can generate anything, so why not have the CMS generate a PHP application...? | |
# /my-page.php => Calls out generated PHP source file | |
add_output :php, :language => "php" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment