BigJobbies
BigJobbies

Reputation: 509

Prestashop / Smarty Template converting to standard php

Im trying to convert a prestashop theme into a wordpress theme and im having issues understanding the smarty template lingo.

I was wondering if someone could tell me in standard php syntax what the following means.

{if isset($css_files)}
    {foreach from=$css_files key=css_uri item=media}
        {if preg_match("#global#",$css_uri)}
            <link rel="stylesheet" href="{$css_uri|escape:'html':'UTF-8'}"  id="global-style" type="text/css" media="{$media|escape:'html':'UTF-8'}" />
        {else}
            <link rel="stylesheet" href="{$css_uri|escape:'html':'UTF-8'}" type="text/css" media="{$media|escape:'html':'UTF-8'}" />
        {/if}
    {/foreach}
{/if}

Any help would be greatly appreciated.

Cheers,

Upvotes: 0

Views: 475

Answers (1)

yenshirak
yenshirak

Reputation: 3106

if (isset($css_files)) {
  foreach ($css_files as $css_uri => $media) {
    if (preg_match("#global#", $css_uri)) {
      echo '<link rel="stylesheet" href="' . htmlspecialchars($css_uri, ENT_QUOTES, 'UTF-8') . '" id="global-style" type="text/css" media="' . htmlspecialchars($media, ENT_QUOTES, 'UTF-8') . '" />';
    }
    else
    {
      echo '<link rel="stylesheet" href="' . htmlspecialchars($css_uri, ENT_QUOTES, 'UTF-8') . '" type="text/css" media="' . htmlspecialchars($media, ENT_QUOTES, 'UTF-8') . '" />';
    }
  }
}

Upvotes: 1

Related Questions