has including files syntax changed in => 2.0 ?

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
User avatar
Don Chambers
Regular
Posts: 3636
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

has including files syntax changed in => 2.0 ?

Post by Don Chambers » Wed Mar 18, 2015 8:20 pm

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?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

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

Post by Timbalu » Wed Mar 18, 2015 8:31 pm

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...
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3636
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers » Wed Mar 18, 2015 9:43 pm

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?

User avatar
yellowled
Regular
Posts: 7072
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

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

Post by yellowled » Wed Mar 18, 2015 9:48 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Don Chambers
Regular
Posts: 3636
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers » Wed Mar 18, 2015 10:09 pm

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.

User avatar
Dergln
Regular
Posts: 54
Joined: Thu Jun 23, 2011 8:18 pm
Location: Hessen
Contact:

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

Post by Dergln » Fri Mar 20, 2015 12:40 am

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

Czorneboh
Regular
Posts: 383
Joined: Tue Apr 08, 2008 7:17 pm
Location: Berlin
Contact:

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

Post by Czorneboh » Sat Aug 22, 2015 1:35 pm

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

User avatar
yellowled
Regular
Posts: 7072
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

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

Post by yellowled » Tue Aug 25, 2015 6:00 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

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

Post by Timbalu » Tue Aug 25, 2015 8:26 pm

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?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3636
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers » Tue Aug 25, 2015 9:40 pm

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?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

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

Post by Timbalu » Wed Aug 26, 2015 8:58 am

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.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3636
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers » Wed Aug 26, 2015 3:50 pm

I thought you already had the kinetic files. If not, would you like me to send them to you?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

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

Post by Timbalu » Wed Aug 26, 2015 4:39 pm

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!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
Don Chambers
Regular
Posts: 3636
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

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

Post by Don Chambers » Wed Aug 26, 2015 5:45 pm

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?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

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

Post by Timbalu » Wed Aug 26, 2015 5:54 pm

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!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

Post Reply