fuel / parser

Fuel PHP Framework - v1.x template parser package adapters
http://fuelphp.com
64 stars 45 forks source link

Parser Forge to default to Core View Extension #41

Closed dmyers closed 12 years ago

dmyers commented 12 years ago

There is a protected variable on the \Fuel\Core\View called "extension" which when set, sets the default. It would be nice if the Parser View would default to that if no extension is detected when using the pathinfo($file).

So instead of:

$extension  = pathinfo($file, PATHINFO_EXTENSION);

It would be something like:

$extension  = pathinfo($file, PATHINFO_EXTENSION);

if (empty($extension)) {
   $extension = $this->extension;
}

What do you guys think?

frankdejonge commented 12 years ago

I think it's a good idea. Implementing it now.

frankdejonge commented 12 years ago

Wait a second...

frankdejonge commented 12 years ago

Although the way it's done is a bit of a cheat, when no extension is provided, the called class is the class that will be returned (through config get default), allowing View_Haml::forge to return a Haml view when no extension is provided, which is what you'd want. When we implement the fallback to $this->extension this functionality will disappear. Aka "not what we want".