Advertisement
stom66

Bootstrap4 AppManifest

Nov 14th, 2017
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Smarty 1.83 KB | None | 0 0
  1. {strip}
  2. {*
  3. *   Template name: Bootstrap4 AppManifest
  4. *   -------------------------------------
  5. *
  6. *   This section of the template is designed to output a valid web app manifest file.
  7. *   The values here are automatically calculated based on the settings specified in
  8. *   the "Bootstrap4 Settings" template and this file should need no manual adjustments.
  9. *
  10. *   Part of the CMSMS Bootstrap4 template by stom | stom66.co.uk
  11. *}
  12.     {process_pagedata}
  13.     {content_type type="application/manifest+json"}
  14.     {include file="cms_template:Bootstrap4 Settings"}
  15.     {$content   = "{content}"}
  16.     {$sizes     = [48, 72, 96, 144, 168, 192]}
  17.     {$icons     = []}
  18.  
  19.  
  20.     {foreach from=$sizes item=size}
  21.         {$file_ext          = $manifest_icon|pathinfo:$smarty.const.PATHINFO_EXTENSION|lower}
  22.         {if ($file_ext=="png")}
  23.             {$icon.type         = "image/png"}
  24.         {elseif ($file_ext=="jpg" || $file_ext=="jpeg")}
  25.             {$icon.type         = "image/jpeg"}
  26.         {elseif ($file_ext=="svg")}
  27.             {$icon.type         = "image/svg+xml"}
  28.         {elseif $file_ext=="webp"}
  29.             {$icon.type         = "image/webp"}
  30.         {/if}
  31.  
  32.         {if $file_ext == "svg"}
  33.             {$icon.src      = $manifest_icon}
  34.         {else}
  35.             {CGSmartImage   assign=foo src=$manifest_icon notag=1 noembed=1 filter_resizetofit="{$size},{$size},#ff000,126"}
  36.             {$icon.src      = $foo}
  37.         {/if}
  38.  
  39.         {$icon.sizes        = "{$size}x{$size}"}
  40.         {append var="icons" value=$icon}
  41.     {/foreach}
  42.  
  43.     {$output.lang               = $page_lang}
  44.     {$output.background_color   = $background_color}
  45.     {$output.description        = $manifest_desc}
  46.     {$output.display            = $manifest_display_style}
  47.     {$output.name               = "{sitename}"}
  48.     {$output.short_name         = "{sitename}"}
  49.     {$output.start_url          = "{root_url}"}
  50.     {$output.theme_color        = $theme_color}
  51.     {$output.orientation        = $manifest_orientation}
  52.     {$output.orientation        = $manifest_orientation}
  53.     {$output.icons              = $icons}
  54.  
  55.     {$output|@json_encode nofilter}
  56. {/strip}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement