-
Notifications
You must be signed in to change notification settings - Fork 68
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
template compiling problem for 'non-local' templates #627
Comments
I also thought about setting the template location/path from within scribite Zikula_View does not have a method for doing so (manual override so to speak). I have also tried multiple other pathnames to get the template available but nothing works. only |
Shouldn't you be using |
I'm investigating that now. It is being used from with the HookHandler though... |
Shouldnt matter. Use |
this works:
and creates the following compile directories: however, the compiling of non-local templates is still a problem. according to @Drak, Zikula does not support this because of problems with the vendor's handling of filenames/paths (Smarty) and therefore "there should be another way". I'm leaving this ticket open for now hoping that @matheo or @jusuff will have some thoughts on the matter.... |
Unless there is a strong use-case for having to support |
Even so, it's clear that windows is not a production target otherwise there would have been many bug reports about this. |
As long as it works on linux it's fine for production environments, but for local testing this would be not convenient to say the least. Within Content it might be that this was coded at some stage, since in earlier days I cannot remember that there was something like that in the code :-) I also don't know how to solve it actually. In Content before upgrading to OO as it is now the getXtemplates function was not there afais in the code. This was just hard coded in the template for the calling module. |
What are the paths Content is trying to map with this notation? |
I'm not sure I understand @Drak 's question. for certain, I am the one that coded these methods when I refactored Content (v4.0.0). The problem as I recall, was that the template can come from anywhere (ContentTypes are in many different modules) and so I needed a way to get them from the document root. Or something like that. It's been a while since I did that and I don't remember exactly. Content does things a bit wacky and there are multiple instances of Zikula_(Form_)View passing around making things even more complicated and memory intensive. I remember having to create and destroy instances of View to get the job done. |
True, the view instances had to be destroyed in some places, I can also remember that. I have not dived into those methods to be honest (should have done that probably back then ...), but they worked. |
// Get the full path of the template.tpl template $smarty->assign('one_var', dirname(FILE).'/template.tpl'); And the following code: or something different like: (I don't know how to put this in php) if substr( $string_n, 0, 7 ) === "file:///" $filename = filename: |
I just tried this in Zikula Core 1.3.4 build 35 and current github version of Content and News and there also the template is not found. So on Win xampp platform the template ath with file: resource and absolute paths don't work.
|
I now notice that going back to DataUtil of Zikula Core 1.3.4 build12 does work with on Windows systems. Apparantly the creating of the compiled version of the template uses FormatForOS, since that is the only difference I could find between 134 and 138 in this problem scope. It's not an issue in production, but for testing it makes it so much easier when this works again. for instance for Content as it is now. What does make it work is changing back again in DataUtil line 413:
into
not sure why the : was excluded from the pregsplit. The update was done here: |
| Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | - | Fixed tickets | zikula#627 | Refs tickets | zikula-modules/Content#135 | License | MIT | Doc PR | - On windows test environments an absolute template path is not working currently. Compiled template gives errors, see ticket zikula#627 for more information. During the change from 1.3.4 build 12 to 1.3.5 this part was changed in zikula@9e74470 Removal of the : in the preg_split makes that win test environments don't work with absolute template paths any more. I cannot see a side effect of adding this : back in the preg_split. It does solve windows testing for a number of modules. ping @cmfcmf can you check as well ?
| Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | - | Fixed tickets | zikula#627 | Refs tickets | zikula-modules/Content#135 | License | MIT | Doc PR | - On windows test environments an absolute template path is not working currently. Compiled template gives errors, see ticket zikula#627 for more information. During the change from 1.3.4 build 12 to 1.3.5 this part was changed in zikula@9e74470. This update reverts a part of that udpate. Removal of the : in the preg_split makes that win test environments don't work with absolute template paths any more. I cannot see a side effect of adding this : back in the preg_split. It does solve windows testing for a number of modules. ping @cmfcmf can you check as well ?
thank you @cmfcmf Christian for fixing this elusive problem! |
👍 |
I am working (with Jusuff) on scribite right now. As a hook-based module it needs to pull in templates that are not 'local' in the sense that they are not from the current top-level module. In order to do so, I've used the advanced functionality of Smarty and used template locations like this:
see http://www.smarty.net/docsv2/en/template.resources.tpl#templates.from.any.dir
so this works fine* on linux/bsd based systems but completely fails in windows. Jusuff is the one to discover the problem with windows. The problem comes when the template is compiled and the location isn't correctly set. Then it cannot be rendered properly when sending to the browser. Jusuff was
*while it 'works' on my BSD (macos) machine, it does produce an odd structure. See the picture below where the "file/modules" has created a directory with a slash in the name somehow.
@jusuff @matheo
The text was updated successfully, but these errors were encountered: