stom66

CMSMS Plugins content_type

Nov 14th, 2017
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // A simple function to change the content type of the current page
  3. //
  4. // Ported from a UDT written by RolfTj @ https://www.cmscanbesimple.org/blog/create-dynamic-sitemaps-and-robots-txt#pages
  5. // Place in /assets/plugins/function.content_type.php
  6. // Use i param for shorthand
  7. // Use 'type' param to set type
  8. //
  9. // Examples:
  10. // {content_type type='text/plain'}
  11. // {content_type type='application/manifest+json'}
  12.  
  13. function smarty_function_content_type($params, &$smarty) {
  14. $content_type = get_parameter_value($params,'type');
  15. if ($content_type != '') {
  16. cmsms()->set_content_type($content_type);
  17. }
  18. }
  19. ?>
RAW Paste Data