function replace(&$template) { // Function modified in v2.1.0 to use content template without specific module. // If we do not use a content template, extract the content from buffer if ($this->content_template_file == '') { $template['content'] = sts_strip_content_tags($template['content'], 'Default Content'); return; } // Otherwise continue and use the content template to build the content global $template_content; // Read content template file $template_html = sts_read_template_file($this->content_template_file); foreach ($template_content as $key => $value) { $template_html = str_replace('{$' . $key . '}', $value, $template_html); } $template['content'] = $template_html; }
function infoBoxTemplate($content) { // STS 4.3: read content, display header & content. // STS 4.4: reset headertext and right_arrow variables in case next box has no header. global $sts; $btrace = debug_backtrace(); $boxname = basename($btrace[1]['file'], ".php"); // backtrace 1 is the calling file $boxprefix = "infobox_"; // Added in v4.3SP2. // Added in v4.4: allows to use catalog_filename.html as template for boxes created directly in a catalog script. $boxname2 = basename($btrace[2]['file'], ".php"); // backtrace 2 is the file calling the calling file (like sts_column_left.php) if ($boxname2 == '') { $boxprefix = "catalog_"; } if (file_exists(STS_TEMPLATE_DIR . "boxes/{$boxprefix}{$boxname}.php.html")) { $template = sts_read_template_file(STS_TEMPLATE_DIR . "boxes/{$boxprefix}{$boxname}.php.html"); } elseif (isset($sts->infobox['default_content'])) { $template = $sts->infobox['default_content']; // Default box already in memory, get it from there } else { // Otherwise read it from file and save it $template = sts_read_template_file(STS_TEMPLATE_DIR . "boxes/infobox.php.html"); $sts->infobox['default_content'] = $template; } $template = $sts->infobox_header_template . "\n" . $template; // Add header before the content. Header can be empty. $template = str_replace('$headertext', $sts->infobox_headertext, $template); $template = str_replace('$right_arrow', $sts->infobox_right_arrow, $template); $template = str_replace('$content', $content, $template); echo $template; $sts->infobox_header_template = ''; $sts->infobox_headertext = ''; $sts->infobox_right_arrow = ''; }
function replace(&$template) { // If we do not use a content template, extract the content from buffer if ($this->content_template_file == '') { $template['content'] = sts_strip_content_tags($template['content'], 'Product Info Content'); return; } // Otherwise continue and use the content template to build the content global $template_pinfo; // Read content template file $template_html = sts_read_template_file($this->content_template_file); if (!defined('STS_CONTENT_END_CHAR')) { // If no end char defined for the placeholders, have to sort the placeholders. uksort($template_pinfo, "sortbykeylength"); // Sort array by string length, so that longer strings are replaced first define('STS_CONTENT_END_CHAR', ''); // An end char must be defined, even if empty. } foreach ($template_pinfo as $key => $value) { $template_html = str_replace('$' . $key . STS_CONTENT_END_CHAR, $value, $template_html); } $template['content'] = $template_html; }