Template includes don't convert (v. 2.94 Build 1-4)

When SiteBuilder includes are added to your templates, they must be in the format:

with the exact spacing as shown above. The concatenation operator (.) must have one space before it, and no space after it. If that spacing is off or there are extra/missing spaces anywhere, the system will not convert the include from the long PHP include to the short include (e.g. %INCLUDE_NAME%) if you customize that template. While this causes no problem in the template itself, it can be an issue if you use the template editor, because PHP isn't parsed correctly via the editor.

To correct this:

Option 1: If your templates have the wrong spacing, just correct that spacing in the template .htm file itself, and reload the file.

Option 2: Turn off the template editor (Administration -> Catalog Setup -> Admin -> Template Editor -> No) before customizing the template, or click the <> button in the editor and manually change PHP includes to the short include value before saving. For instance, change to %BRAND%.

Option 3: Use the following modification to automatically reformat incorrectly formatted includes:

  1. Open the template.php file in the /storeadmin/ folder.

  2. Find the following code:

  3. $contents = str_replace('.php");', '.php"); ?>', $contents);
  4. Just below that code, add the following:

  5. // FORMAT TO MATCH LEGACY TEMPLATES
    $pull_includes = preg_match_all('//s', $contents, $pull_matches);
    if (!empty($pull_matches[0]))
    {
     foreach($pull_matches[0] AS $pullcode)
     {
      $pull_code = preg_replace('/s+/', ' ', str_replace("'", '"', $pullcode));
      $pull_code = str_replace(array('. ', ' .', ' . '), '.', $pull_code);
      $pull_code = str_replace('SB_HOME_PATH."/".SB_INC_DIR."/', 'SB_HOME_PATH ."/" .SB_INC_DIR ."/', $pull_code);
      $contents = str_replace($pullcode, $pull_code, $contents);
     }
    }
  6. Save and reload the file.