Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to set dirs without trailing slashes #406

Closed
sirian opened this issue Feb 9, 2013 · 7 comments
Closed

Allow to set dirs without trailing slashes #406

sirian opened this issue Feb 9, 2013 · 7 comments
Labels
enhancement Enhancement to the framework not a bug Reported issue is not a bug

Comments

@sirian
Copy link
Contributor

sirian commented Feb 9, 2013

now this lines works differently (first doesn't work)

$view->setViewsDir('../app/views')
$view->setViewsDir('../app/views/')

same problem with Volt's compiledPath options

@phalcon
Copy link
Collaborator

phalcon commented Feb 9, 2013

Yes, the trailing slash is required in most paths, this reduces the overhead of creating the real paths, in most parts of the docs that is mentioned

@sirian
Copy link
Contributor Author

sirian commented Feb 9, 2013

for example here: http://docs.phalconphp.com/en/latest/reference/views.html no words about trailing slashes. And it's hard to guess why templates don't render

@sirian
Copy link
Contributor Author

sirian commented Feb 9, 2013

Why can't you manually determine existence of a slash at the end of the line (and if needed - append it)?

@phalcon
Copy link
Collaborator

phalcon commented Feb 9, 2013

We need to create a full copy of path to just add the trailing slash,(not a big problem) but if the developer adds the trailing slash this reduce an unnecessary work in each request

@sirian
Copy link
Contributor Author

sirian commented Feb 9, 2013

At least phalcon should display warning (or exception) if path hasn't trailing slash at the end (otherwise it's really hard to determine problem)

@denislins
Copy link

I'm sorry to reopen this really old discussion, but I just passed by the same situation and I have to say that I totally agree with the last message of @sirian.

I spent about two or three real hours, digging into the phalcon's C code, extending the framework classes, just to realize that my viewsDir path didn't had the slash at the end.

I'm not saying that I wasn't wrong, and the documentation probably have mention that, but raising an error is really important for developers. For instance, in my case, I'd just see that the path was wrong, and put the slash there, in about 20 seconds, instead of some hours.

phalcon pushed a commit that referenced this issue Oct 28, 2013
Make sure the string is not interned (#406)
@ghost
Copy link

ghost commented Jan 28, 2014

I guess this one can be closed now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to the framework not a bug Reported issue is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants