在scssphp中传递php变量(Joomla params)

时间:2017-01-16 14:26:27

标签: php joomla parameters sass less

在Joomla中你可以从模板传递php变量,例如在较少的文件中。现在我尝试用scssphp(leafo.net的scss编译器)做同样的事情

所以我想首先我必须在style.php中load the Joomla Framework,并在那里定义变量$options = $this->params->get('option');,但我不确定。

这有可能吗?我所有的测试都失败了......

这是一个例子:

require_once "scssphp/scss.inc.php";
use Leafo\ScssPhp\Server;
$directory = "scss";
Server::serveFrom($directory);

// Get Joomla! framework 
define( '_JEXEC', 1 ); 
define( '_VALID_MOS', 1 ); 
define( 'JPATH_BASE', realpath(dirname(__FILE__))); 
define( 'DS', DIRECTORY_SEPARATOR ); 
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); 
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); 
$mainframe =& JFactory::getApplication('site'); 
$mainframe->initialise(); 

$option = $this->params->get('option');

如果我现在在style.scss中使用@option,我会收到此错误:

解析错误:未定义变量$ option:line:14

0 个答案:

没有答案