Help us understand the problem. What is going on with this article?

FuelPHPでMustacheテンプレートのpartials機能を利用する方法

More than 5 years have passed since last update.

以下のようにparserパッケージ修正したのち、コンフィグファイルの設定を行うと利用できる。
なぜにデフォルトで使えない。。。

parser/classes/view/mustache.php
namespace Parser;

use Mustache_Engine;
// 追記
use Mustache_Loader_FilesystemLoader;

class View_Mustache extends \View
{
    protected static $_parser;

    protected function process_file($file_override = false)
    {
        $file = $file_override ?: $this->file_name;
        $data = $this->get_data();

        try
        {
            return static::parser()->render(file_get_contents($file)
, $data);
        }
        catch (\Exception $e)
        {
            // Delete the output buffer & re-throw the exception
            ob_end_clean();
            throw $e;
        }
    }

    public $extension = 'mustache';

    /**
     * Returns the Parser lib object
     *
     * @return  Mustache_Engine
     */
    public static function parser()
    {
        if ( ! empty(static::$_parser))
        {
            return static::$_parser;
        }

        $options = array(
            // TODO: set 'logger' with Monolog instance.
            'cache'   => \Config::get('parser.View_Mustache.environm
ent.cache_dir', APPPATH.'cache'.DS.'mustache'.DS),
            'charset' => \Config::get('parser.View_Mustache.environm
ent.charset', 'UTF-8'),
        );

        if ($partials = \Config::get('parser.View_Mustache.environment.p
artials', array())) {
            $options['partials'] = $partials;
        }

        if ($helpers = \Config::get('parser.View_Mustache.environment.he
lpers', array())) {
            $options['helpers'] = $helpers;
        }

       // 追記(ディレクトリは好きな位置を指定)
     $options['partials_loader'] =
         new Mustache_Loader_FilesystemLoader(
           dirname(__FILE__) . '/../../../../app/views');

        static::$_parser = new Mustache_Engine($options);

        return static::$_parser;
    }
}

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away