Skip to content

Conversation

@Haehnchen
Copy link
Owner

its allowed to put twig files in subfolder this should fix the path resolver like mention in #17

AppBundle:Conversation/list:tableRowPart.html.twig
Folder/Subfolder/file.html.twig -> BundleName:Folder/Subfolder:file.html.twig

@adrienbrault
Copy link
Contributor

So both AcmeDemoBundle:Welcome/Subdirectory:template.html.twig, AcmeDemoBundle:Welcome:Subdirectory/template.html.twig are valid ?

@ruudk
Copy link
Contributor

ruudk commented Apr 11, 2013

Si

👍 for this!

@Haehnchen
Copy link
Owner Author

no only AcmeDemoBundle:Welcome/Subdirectory:template.html.twig
symfony/symfony@9920289

@adrienbrault
Copy link
Contributor

Ok, but the current behavior is to autocomplete names like AcmeDemoBundle:Welcome/Subdirectory:template.html.twig.
Your commit changes this behavior and provide autocomplete on names like : AcmeDemoBundle:Welcome:Subdirectory/template.html.twig

@Haehnchen
Copy link
Owner Author

sry too fast :)

the common way would be:
AcmeDemoBundle:Welcome:Subdirectory/template.html.twig

"Symfony2 uses a bundle:controller:template string syntax for templates. This allows for several different types of templates, each which lives in a specific location"
http://symfony.com/doc/current/book/templating.html

futhermore AcmeDemoBundle:Welcome/Subdirectory:template.html.twig is also valid and working, so we should implement both i think

@adrienbrault
Copy link
Contributor

We shouldn't implement both for autocompletion, because we'd get 2x results.
IMHO AcmeDemoBundle:Welcome/Subdirectory:template.html.twig is cleaner.

So I'd keep template autocompletion the same, but I'd allow "click to go to definition" on template name like AcmeDemoBundle:Welcome:Subdirectory/template.html.twig.

What do you think ?

@Haehnchen
Copy link
Owner Author

we should not provide double results on autocomplete, thats a good point. the solution to spilt this looks good to me. but which one use as default for autocomplete?

a symfony2 parent bundle can overwrite other bundle template files. i correctly dont now if that feature can also reslove AcmeDemoBundle:Welcome/Subdirectory:template.html.twig in the correct way.

@adrienbrault
Copy link
Contributor

I know! We can put a settings to choose whether the user want to use xxx:xxx/xxx:xxx.twig or xxx:xxx:xxx/xxx.twig.

@adrienbrault
Copy link
Contributor

symfony2 parent bundle can overwrite other bundle template file. i correctly dont now if that feature can also reslove AcmeDemoBundle:Welcome/Subdirectory:template.html.twig in the correct way.

Symfony abstracts template path with a TemplateReference object, that is relative to a bundle, so this shouldn't change anything

@adrienbrault
Copy link
Contributor

And xxx:xxx/xxx:xxx.twig is better, because the first part is the bundle, the second part the directory, and the third the file.
Whereas xxx:xxx:xxx/xxx.twig has directory reference in 2 parts ...

@Haehnchen
Copy link
Owner Author

i will later on check the behavior of other IDEs on this

@egils
Copy link

egils commented Apr 12, 2013

I did a very little research on this issue. And all I was able to find was xxx:xxx/xxx:xxx.xxx.twig.
Looked in Symfony2 plugin autocomplete for Eclipse (Zend Studio) as well as Symfony2 documentation examples:
http://symfony.com/doc/current/book/controller.html#rendering-templates - last example for section.
And in my personal opinion I agree with adrienbrault's comment "And xxx:xxx/xxx:xxx.twig is better, because the first part is the bundle, the second part the directory, and the third the file."

I know it's not enough to jump into conclusions, but still some factors to consider while deciding.

@Sorien
Copy link
Contributor

Sorien commented Apr 12, 2013

its not about which one is better, its on developer which one he decide to use, its a bit problem when plugin supports only xxx:xxx/xxx:xxx.twig and your whole project is using xxx:xxx:xxx/xxx.twig and so when you don't want to mix syntax you'll be forced to rewrite it on x places which is not helpin' us ... so it should be configured

btw i've never seen using of xxx:xxx/xxx:xxx.twig until now

@adrienbrault
Copy link
Contributor

@Haehnchen FYI, you pushed b201275 to the branch of this pull request

@dlsniper
Copy link
Contributor

Hello, can I help this feature with anything? If so, please let me know :)

@eXtreme
Copy link

eXtreme commented May 4, 2013

Well there are two cases:

  1. You put your controllers in subfolder so you have: AcmeBundle\Controller\Foobar\Baz.php and for action test the template path would be AcmeBundle:Foobar/Baz:test.html.twig
  2. You put a controller in a normal namespace/directory but your template is in subfolder so for AcmeBundle\Controller\Baz::testAction you could have AcmeBundle:Baz:foobar/test.html.twig

It is the way I write template paths. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants