Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

is this available in smary 3

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Sat May 22, 2010 7:51 am    Post subject: is this available in smary 3 Reply with quote

I am a smarty 2x user , and I found a problem that has to do with permissions.

I know you have to assign permission to the cache directory, however is there a way that I would not need to do that ( for special cases ) , like for example a requirement check script I was working on, and I wasn't able to run smarty because the permissions weren't set , is there a way to turn off this so that it will compile everything of the fly without the need to write anything?, I turned of caching and it would still fail. So, the way around for this was Not to use smarty at all for the script until the requirement check was done and told the user there is where he need to put the permission, but I wasn't able to use smarty there... it would be sort of cool to allow to compile everything on the fly without caching anything at all, without permission requirements (chmod) as an option

In the other hand, what are the major (or useful) things that are available in smarty 3 that aren't in smarty 2, (other than the re-factoring structure)
_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sat May 22, 2010 1:07 pm    Post subject: Reply with quote

compile on the fly with no compile files would be horridly slow, you do not want that. read the README that comes with the distro for specifics about smarty 3.
Back to top
View user's profile Send private message Visit poster's website
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Sat May 22, 2010 1:11 pm    Post subject: Reply with quote

Quote:
compile on the fly with no compile files would be horridly slow,


I understand that.
Quote:

"you do not want that."

Why not? , and I do.

Like i mentioned in the post, it is much of a one time deal until/ or much of very rare situation, the user sets the required permissions (much like an installation process). I understand it would be slower than usual.

Quote:
read the README that comes with the distro for specifics about smarty 3.

ok? but for what you said, that will no help at all the cause that I mentioned.
_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sat May 22, 2010 1:20 pm    Post subject: Reply with quote

No, templates will not compile and execute without the writeable directory.

you asked:
Quote:

In the other hand, what are the major (or useful) things that are available in smarty 3 that aren't in smarty 2, (other than the re-factoring structure)


I reply, read the README.
Back to top
View user's profile Send private message Visit poster's website
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Sat May 22, 2010 1:23 pm    Post subject: Reply with quote

Quote:
No, templates will not compile and execute without the writeable directory.


Ok, that stinks, I found that out the hard way. But there should be an option to do it that way if the developers wants to? , if the users wants to. You say "No no no no don't do it that way, you don't want that" sounds to me that you are taking developer freedoms away ^_^

I had to do double work, by translating the functions into plain html to do that way, so it sorts makes me think that ....... that option should at least be there, obviously not set by default as turned on and acknowledging that it is slower

Quote:
Then you asked whats new about smarty 3, I said read the README.


Ok I see
_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sat May 22, 2010 1:37 pm    Post subject: Reply with quote

You could default your application to write the compiled files to the /tmp directory if you want a temporary way to view the compiled files. Of course this could just lead to new problems if you don't bother getting the directory changed. That is one reason why we don't supply a way to do this (or compile on the fly) out of the box, it just leads to new problems and FAQs.
Back to top
View user's profile Send private message Visit poster's website
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Sat May 22, 2010 1:48 pm    Post subject: Reply with quote

mohrt wrote:
You could default your application to write the compiled files to the /tmp directory if you want a temporary way to view the compiled files. Of course this could just lead to new problems if you don't bother getting the directory changed.


True, it would generate more problems. Why not just add that option to smarty so that if the user wants he can run it slow?, but like I said that was an installation processes or that would only be used in rare occasions, so it would not slow down the server (as if it was available to the public view).

Quote:
if you don't bother getting the directory changed.


Yes the directory would get changed at some point after the one of the steps that would have been generated by the ^ above. But not before because the users wouldn't know, so what if I want to display a friendly page saying.. hey you go change the permissions - I wouldn't be able to , unless i do double work without the options ^ above...

So basically in the first place I thought caching=false would take care of that, but boy I was wrong... I release my application and found out a lot of people weren't able to install ..

I am pretty sure I am not the only one that has ran into this problem. I am sure a lot of people would love to have that, but since it is rarely used probably doesn't have much demand, and people would just go and code a separate mini template engine (as I did to mimic some of the functions that were meant to be targeted for smarty in the first place) or keep the html into the php code, isn't that the point of smarty in the bigger picture to avoid?
_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat May 22, 2010 8:38 pm    Post subject: Reply with quote

Here is the trick not to generate compiled files.

Add this to your script
Code:

class Smarty_Resource_Foo extends Smarty_Internal_Resource_File {
    public $isEvaluated = true;
}

....
$smarty->default_resource_type = 'foo';
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP