Welcome Guest, Not a member yet? Register   Sign In
CI with Smarty - Problems with Included content...
#1

[eluser]Myles Wakeham[/eluser]
I use Smarty with CI and have for a while. It has been working fine for me on some big applications, however recently I started to notice on a new application I was working on that about 5% of the time, I found that it would not resolve Smarty tags when working with CI.

I found that if I removed the compiled Smarty template content on the server (templates_c folder content) and started again, it was fine for a while but eventually would return to similar behavior. So I have spent the past few hours digging deep to find out what is going on. I've found some interesting things....

Smarty has a wonderful tag that can be inserted into a template file called {include file="xxxxxx"} where you have force Smarty to include the block into the template file before it is sent out to the browser. This is great for design, as it allows one to break up a web page into segments and deal with the segments separately.

However this seems to be the culprit with CI. If I use this command to combine all the blocks together, I find that the original master TPL file that contains the {include file="xxxxxx"} statements won't resolve the tags in the master TPL file, but will resolve the tags in the included block. Again, this only occurs about 2% of the time.

It would appear that it has something to do with the way that CI is caching the content and interfering with Smarty. I have other applications that have been in production for years that use CI & Smarty and they work perfectly. However the main difference is that they don't use the {include file="xxxxxxx"} statement at all.

So before I go through literally 50 TPL files and force them to include the actual blocks in the master TPL files, I wanted to reach out to the CI community and see if anyone else had experienced what I am describing. If so, out of interest are you using {include file="xxxxxx"} statements in your TPL files? If you were able to get around this issue, what's the secret?

Here's a screenshot of the end result of this problem if anyone is interested:

SCREENSHOT

Thanks in advance for any feedback.

Myles


Messages In This Thread
CI with Smarty - Problems with Included content... - by El Forum - 04-23-2008, 01:55 AM
CI with Smarty - Problems with Included content... - by El Forum - 06-23-2008, 11:28 AM
CI with Smarty - Problems with Included content... - by El Forum - 06-23-2008, 11:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB