Really nice work, I got it working today. The feature of gradually moving 
from .ctp to .mustache files is great!

The limitations are a little bit annoying as you mentioned... to create a 
'helper' .php file just to get default functions working correctly (methods 
css, script etc.).

*Is there a possibility to call a function/method directly in the .mustache 
file and passing an argument?* It seems that Mustache doesn't allow this by 
default (except usinf Lambdas)... If yes, some limitations could be 
obsolete, e.g. all the stuff defined in 
`/View/Layouts/DefaultLayoutViewModel.php` like:

class DefaultLayoutViewModel extends MustacheViewModel {
        public function css() {
                return $this->_View->fetch('css');
        }
}

It would be great to call functions like RainTPL 
does<http://www.raintpl.com/Quick-Start/#func> including 
passing arguments. The reason why I'm asking for this is using 
Internationalization 
and 
Localization<http://book.cakephp.org/2.0/en/core-libraries/internationalization-and-localization.html>
 using 
the `__('SomeString')` function.

*Or do you have another idea to get `__(...)` working?*

Thanks for your great work so far!

Am Montag, 22. Juli 2013 09:56:34 UTC+2 schrieb Dismounted:
>
> Yep, using this for all my views.
>
> The biggest limitation I'm finding at the moment is that view blocks are 
> not lazily loaded (they're imported in the render class's constructor), 
> however, I'm only using blocks in layouts to grab things like "meta", 
> "css", "scripts" and "content". This can be fixed by moving things around a 
> little bit, and I'm thinking of the best way to do that. I'm finding that 
> blocks are not used much when writing Mustache templates.
>
> MustacheCake will attempt to find view (and element) files in this order:
> - Using the extension specified by your controller (Controller::$ext).
> - Using ".mustache".
> - Using ".ctp".
>
> If a view (or element) is found to use a ".ctp" extension, MustacheCake 
> will be "smart" and pass it back to render using the normal Cake 
> View::_evaluate() routine. So all your "old" templates render as usual.
>
> Also, you can call elements using $this->_View->element('foo') in render 
> classes to place them into Mustache templates (N.B. using Mustache partials 
> syntax will put them through the Mustache renderer only). I have not tried 
> going the other way, but it should work as well (i.e. call Mustache 
> elements in ".ctp" files using $this->element('foo')).
>
> Neat thing about this is that you can use plugins like DebugKit without 
> recreating any of their views, while using Mustache for all your project's 
> views and elements.
>
> On Monday, 22 July 2013 14:06:44 UTC+10, #2Will wrote:
>>
>> This is cool.  Nice one!
>>
>> Are you using these for all your views? Are there any limitations you 
>> have come across using for templates? for example  Can you call elements in 
>> .ctp files from the moustache files & vice-versa?
>>
>> Will
>>
>>
>>
>> On Saturday, 20 July 2013 23:31:58 UTC+10, Dismounted wrote:
>>>
>>> Hi all,
>>>
>>> I've just committed a "final"-ish version of my plugin that integrates 
>>> Mustache (http://mustache.github.io/) as a custom View class in Cake.
>>>
>>> Why did I create "yet another" one of these? From what I've been able to 
>>> find, other Mustache plugins either: a) implement Mustache as a view 
>>> helper, not as a complete view rendering system replacement; or b) are 
>>> created for older versions of Cake.
>>>
>>> Please take a look and let me know of any 
>>> suggestions/improvements/issues. To get started, there are a couple of 
>>> example files in "MustacheCake/View/Layouts" and "MustacheCake/View/Pages", 
>>> which are the default shipped Cake files transposed into Mustache syntax.
>>>
>>> GitHub repo: https://github.com/Dismounted/MustacheCake 
>>>
>>> Cheers!
>>>
>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to