/** * Open, parse, and return the template file. * * @param $file string the template file name */ public function fetch($file = null) { $template = new CTemplateHelper(); $tmpFile = $file; if (empty($file)) { $file = $this->file; } if ($this->mobileTemplate()) { $file = $template->getMobileTemplateFile($file); } else { $file = $template->getTemplateFile($file); } // Template variable: $my; $my = CFactory::getUser(); $this->setRef('my', $my); // Template variable: $config; if (!isset($this->vars['config']) && empty($this->vars['config'])) { $this->vars['config'] = CFactory::getConfig(); } // Template variable: the rest. if ($this->vars) { extract($this->vars, EXTR_REFS); } if (!JFile::exists($file)) { $mainframe =& JFactory::getApplication(); $mainframe->enqueueMessage(JText::sprintf('COM_COMMUNITY_TEMPLATE_FILE_NOT_FOUND', $tmpFile . '.php'), 'error'); return; } ob_start(); // Start output buffering require $file; // Include the file $contents = ob_get_contents(); // Get the contents of the buffer ob_end_clean(); // End buffering and discard // Replace all _QQQ_ to " // Language file now uses new _QQQ_ to maintain Joomla 1.6 compatibility $contents = CTemplate::quote($contents); return $contents; // Return the contents }
/** * Open, parse, and return the template file. * * @param $file string the template file name */ function fetch($file = null) { $template = new CTemplateHelper(); $tmpFile = $file; if (empty($file)) { $file = $this->file; } if ($this->mobileTemplate()) { $file = $template->getMobileTemplateFile($file); } else { $file = $template->getTemplateFile($file); } // Extract template parameters for template providers. if (!isset($this->params) && empty($this->params)) { $this->params = $this->getTemplateParams(); } // Template variable: $my; $my = CFactory::getUser(); $this->setRef('my', $my); // Template variable: $config; if (!isset($this->vars['config']) && empty($this->vars['config'])) { $this->vars['config'] = CFactory::getConfig(); } // Template variable: the rest. if ($this->vars) { extract($this->vars, EXTR_REFS); } if (!JFile::exists($file)) { $mainframe =& JFactory::getApplication(); $mainframe->enqueueMessage(JText::sprintf('CC TEMPLATE FILE NOT FOUND', $tmpFile . '.php'), 'error'); return; } ob_start(); // Start output buffering require $file; // Include the file $contents = ob_get_contents(); // Get the contents of the buffer ob_end_clean(); // End buffering and discard return $contents; // Return the contents }