尝试使用 mustache.php 调用部分小胡子。我确定我搞砸了,因为文档似乎表明你可以做我想做的事情。
$m = new Mustache_Engine(array(
'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__) . '/patternlab-php-master/source/_patterns/02-organisms/'),
));
echo $m->render('{{> 03-ups/00-two-up }}');
我收到此错误:
Fatal error: Uncaught exception 'Mustache_Exception_UnknownTemplateException' with message 'Unknown template: {{> 03-ups/00-two-up }}' in C:\xampp\htdocs\grogan\wordpress\wp-content\themes\grogan-theme\vendor\mustache\mustache\src\Mustache\Loader\FilesystemLoader.php:102
Stack trace:
#0 C:\xampp\htdocs\grogan\wordpress\wp-content\themes\grogan-theme\vendor\mustache\mustache\src\Mustache\Loader\FilesystemLoader.php(82): Mustache_Loader_FilesystemLoader->loadFile('{{> 03-ups/00-t...')
#1 C:\xampp\htdocs\grogan\wordpress\wp-content\themes\grogan-theme\vendor\mustache\mustache\src\Mustache\Engine.php(617): Mustache_Loader_FilesystemLoader->load('{{> 03-ups/00-t...')
#2 C:\xampp\htdocs\grogan\wordpress\wp-content\themes\grogan-theme\vendor\mustache\mustache\src\Mustache\Engine.php(217): Mustache_Engine->loadTemplate('{{> 03-ups/00-t...')
#3 C:\xampp\htdocs\grogan\wordpress\wp-content\themes\grogan-theme\page-consignment.php(46): Mustache_Engine->render('{{> 03-ups/00-t...')
#4 C:\xampp\htdocs\grogan\wordpress\wp-includes\templ in C:\xampp\htdocs\grogan\wordpress\wp-content\themes\grogan-theme\vendor\mustache\mustache\src\Mustache\Loader\FilesystemLoader.php on line 102
我正在使用 patternlab 来存放我所有的部分并将它们调用到 wordpress 模板中。不确定这是否重要。