Page 1 of 1

has including files syntax changed in => 2.0 ?

Posted: Wed Mar 18, 2015 8:20 pm
by Don Chambers
For several years, the Kinetic template has used several instances of including files in index.tpl, such as this:

Code: Select all

{include file="content_halfbox.tpl"}
In 2.0.1, with absolutely no theme file modifications, and no permission changes, I now get the following error:
Fatal error: Uncaught --> Smarty: Unable to load template file 'content_halfbox.tpl' in '/path/templates/kinetic/index.tpl' <-- thrown in /path/bundled-libs/Smarty/libs/sysplugins/smarty_internal_templatebase.php on line 129
Did something change for including files?

Re: has including files syntax changed in => 2.0 ?

Posted: Wed Mar 18, 2015 8:31 pm
by Timbalu
This is strange and corresponds to a change Garvin did to some templates a few days ago, also wondering about this, and turning these open rel path into real strict rel path, eg

Code: Select all

{include file="./content_halfbox.tpl"}

I can't really tell you why this happens! It did not do this before, lets say a few month ago....
It might be a current Smarty "bug", or might have to do with some of our template fallback changes. I know Smarty generally supports the open rel path, not only the strict ones. And I cannot remember to have read this to be buggy.

I know we did srew on serendipity_getTemplateFile() but this should not influence a smarty include behaviour...

Re: has including files syntax changed in => 2.0 ?

Posted: Wed Mar 18, 2015 9:43 pm
by Don Chambers
Timbalu wrote:This is strange and corresponds to a change Garvin did to some templates a few days ago, also wondering about this, and turning these open rel path into real strict rel path, eg

Code: Select all

{include file="./content_halfbox.tpl"}
that path does work, but is this really necessary? is it 2.0 or 2.0.1? I'm doing my testing on 2.0.1, so not sure myself. Would the "./" portion work prior to this change, or would I need a conditional check for the s9y version?

Re: has including files syntax changed in => 2.0 ?

Posted: Wed Mar 18, 2015 9:48 pm
by yellowled
Don Chambers wrote:is it 2.0 or 2.0.1?
Pretty sure the “old” include syntax already had (irreproducable) issues in 2.0. For instance, I used it to include a Piwik snippet in my blog's theme, which did not work after updating to 2.0.

YL

Re: has including files syntax changed in => 2.0 ?

Posted: Wed Mar 18, 2015 10:09 pm
by Don Chambers
yellowled wrote:
Don Chambers wrote:is it 2.0 or 2.0.1?
Pretty sure the “old” include syntax already had (irreproducable) issues in 2.0.
I cannot find anything in smarty docs that suggests there was a change to the syntax. In my example above, these should be fetching the same file, from the same directory/folder:

Code: Select all

{include file="content_halfbox.tpl"}
{include file="./content_halfbox.tpl"}
Yet the first is not found, where previously it was found. The second method is a relative path, but provides the same path as the template that is including it. This is neither a bugfix nor an additional feature... so there must be some other reason?? My concern is that this is yet another code modification that requires theme modification to allow themes that use included files to work going forward as they did in the past.

Re: has including files syntax changed in => 2.0 ?

Posted: Fri Mar 20, 2015 12:40 am
by Dergln
Maybe this will help.
Output of it would be interesting :)
$template_dir

This is the name of the default template directory. If you do not supply a resource type when including files, they will be found here. By default this is ./templates, meaning that Smarty will look for the templates/ directory in the same directory as the executing php script.
> http://stackoverflow.com/questions/4291 ... e-tpl-file
> http://www.smarty.net/docs/en/variable.template.dir.tpl

Re: has including files syntax changed in => 2.0 ?

Posted: Sat Aug 22, 2015 1:35 pm
by Czorneboh
Hi!

I do miss a result in this thread.
Was the problem solved with the pages, to which DergIn gave the links?

I have after upgrade from 1.78 to 2.02 problems, which probably have the origin in this problem Don repored here.

It is described here (in german) and Timbalu helps to find out the problem, but so far without a reference to this from Don reported smarty-problem:

http://board.s9y.org/viewtopic.php?f=10&t=20472

It seems so, that the problem was not yet solved, right?
I am using the template Kinetic already since a long time.

Pls. have a look at

https://github.com/s9y/Serendipity/issues/331

Re: has including files syntax changed in => 2.0 ?

Posted: Tue Aug 25, 2015 6:00 pm
by yellowled
Czorneboh wrote:I do miss a result in this thread.
I may surprise you, but there isn't always one.

Don and I both experienced this at some point, Ian did not. That may or may not mean that it is irreproducable or limited to very specific environments (different servers, different versions of software involved etc.).

So unless you have another specific test case to reproduce this behaviour, there is no reason to push this issue again.

YL

Re: has including files syntax changed in => 2.0 ?

Posted: Tue Aug 25, 2015 8:26 pm
by Timbalu
Hey Don
Is it possible to give a reproducible showcase and description in what kind of environment and dependency this

Code: Select all

    {include file="content_halfbox.tpl"}
    {include file="./content_halfbox.tpl"}
issue lives. In mean: is there anything that could make Smarty think, the Serendipity template dirs defined, do not fit to your environment, therefore it does not find the file to include by simple relative filename?

Re: has including files syntax changed in => 2.0 ?

Posted: Tue Aug 25, 2015 9:40 pm
by Don Chambers
I'm not sure Ian - I first encountered the problem with s9y 2.0. It is not specific to my theme - YL has encountered the same thing.

Did you see the following on this page?
As of Smarty 3.1 the attribute $template_dir is no longer accessible directly. Use getTemplateDir(), setTemplateDir() and addTemplateDir() instead.
Or is this referring to /serendipity/templates/ and not a specific /templates/THEME/ directory?

Re: has including files syntax changed in => 2.0 ?

Posted: Wed Aug 26, 2015 8:58 am
by Timbalu
No, this not what I meant with environment. It would have been in 1.7+ too, since that was the starting point of Smarty 3.1 in Serendipity, if not related to a specific version change. The quoted thing has nothing to do with it, and is related to the Smarty 2 -> 3 change only.

As I said:
Make us see this happen in another open available theme, to know why it may not work in this "special" case ( or give an open access to kinetic).
We know it must have been the realpath-symlink thing when it happend to Garvin once, which is a special user case. We already know you don't use symlinked directories. We know a normal {include file="test.tpl"} does work, which is something essential in Smarty, see my tests. That all and more is why I need the exact circumstance of this include call, what it does and where it comes from, the exact place and environment in the index.tpl and so on.
You could even place

Code: Select all

$serendipity['smarty']->testInstall();exit;
at the end of your kinetic config.inc.php file and give us the result.

Re: has including files syntax changed in => 2.0 ?

Posted: Wed Aug 26, 2015 3:50 pm
by Don Chambers
I thought you already had the kinetic files. If not, would you like me to send them to you?

Re: has including files syntax changed in => 2.0 ?

Posted: Wed Aug 26, 2015 4:39 pm
by Timbalu
Don Chambers wrote:I thought you already had the kinetic files.
No! It is and was closed source and all your customers, which came up with issues and questions based on this theme, did not give any access or anything away. And I never persuaded them to break this rule of closed access. But I got a little annoyed over time fixing and imagine bugs in something I could not test myself!
Don Chambers wrote: If not, would you like me to send them to you?
Well, not really. I'd say, only if that was the only way to get to get this issue nailed down. But you could as well make a showcase for the 2k11 theme, which I would prefer definitely!

Re: has including files syntax changed in => 2.0 ?

Posted: Wed Aug 26, 2015 5:45 pm
by Don Chambers
Timbalu wrote:No! It is and was closed source and all your customers, which came up with issues and questions based on this theme, did not give any access or anything away.
My intent is to release kinetic openly once we have resolved this issue. I spent more $$ hosting the files on a paid download site than I ever received from sales.
Timbalu wrote: But you could as well make a showcase for the 2k11 theme, which I would prefer definitely!
Do you mean a demo site for 2k11? How would that help us troubleshoot this {include} issue? Or am I misunderstanding?

Re: has including files syntax changed in => 2.0 ?

Posted: Wed Aug 26, 2015 5:54 pm
by Timbalu
Don Chambers wrote:Do you mean a demo site for 2k11?
No, I mean a reproducible code showcase with an open theme.
Don Chambers wrote:How would that help us troubleshoot this {include} issue?
Because this does not happen, normally!