Page 1 of 1
SMARTY system
Posted: Mon Feb 07, 2011 8:05 pm
by JOJOManLV
Does anyone are do something witht smarty system??
Re: SMARTY system
Posted: Mon Feb 07, 2011 8:30 pm
by Xaleph
Smarty templating i assume? I used it sometimes, but i rather not work with it because of the overhead of all the objects being used. However, if you have questions about Smarty, fire away.
Re: SMARTY system
Posted: Mon Feb 07, 2011 8:44 pm
by Jackolantern
Honestly, if you are just looking for a separation of presentation and logic (i.e. a way to get your PHP logic out of your HTML display), I would suggest looking into an MVC library, such as
CodeIgniter. You can keep your code organized by using the Model-View-Controller pattern, and it keeps it from turning into a pile of spaghetti code.
From what I have seen, Smarty is a pretty heavy-handed option that seems best in commercial studios when professional designers are trying to work with professional developers, since it keeps both side's hands off the other.
Re: SMARTY system
Posted: Mon Feb 07, 2011 8:47 pm
by JOJOManLV
Code: Select all
Warning: rename(/home/mwwlistl/public_html/lw/smarty//templates_compile/42af42f184b5f109a2cc66c4e9c7f0f1a496f5d2.file.login.tpl.php) [function.rename]: failed to open stream: Permission denied in /home/mwwlistl/public_html/lw/smarty/libs/sysplugins/smarty_internal_write_file.php on line 48
Warning: rename(/tmp/wrt2iXkfW,/home/mwwlistl/public_html/lw/smarty//templates_compile/42af42f184b5f109a2cc66c4e9c7f0f1a496f5d2.file.login.tpl.php) [function.rename]: Permission denied in /home/mwwlistl/public_html/lw/smarty/libs/sysplugins/smarty_internal_write_file.php on line 48
Warning: chmod() [function.chmod]: No such file or directory in /home/mwwlistl/public_html/lw/smarty/libs/sysplugins/smarty_internal_write_file.php on line 50
Warning: include(/home/mwwlistl/public_html/lw/smarty//templates_compile/42af42f184b5f109a2cc66c4e9c7f0f1a496f5d2.file.login.tpl.php) [function.include]: failed to open stream: No such file or directory in /home/mwwlistl/public_html/lw/smarty/libs/sysplugins/smarty_internal_template.php on line 423
Warning: include() [function.include]: Failed opening '/home/mwwlistl/public_html/lw/smarty//templates_compile/42af42f184b5f109a2cc66c4e9c7f0f1a496f5d2.file.login.tpl.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mwwlistl/public_html/lw/smarty/libs/sysplugins/smarty_internal_template.php on line 423
WTF?? I am not understand anything of it?? and how to fix it??? HELP me please...
You not recomend it for that who start learn PHP??
Re: SMARTY system
Posted: Mon Feb 07, 2011 9:47 pm
by Chris
Those warnings don't have to do with PHP but more with your file/user permissions on your system.
If it's a simple matter of file permissions try chmod them to 777. That will allow everybody and everything to edit and run all your files.
If you're running on a linux server which as far as I can see you are and you are running PHP through a web server like apache. That server won't have any file access outside of its own directory as the user it runs as doesn't really exist. So it shouldn't have any permissions to /tmp/ and a /home/ directory shouldn't really exist for it.
You should be putting your website into /var/www/, your server shouldn't have any access outside of that.
Re: SMARTY system
Posted: Mon Feb 07, 2011 10:11 pm
by Jackolantern
And no, I would definitely not suggest Smarty Templating for someone just starting to learn PHP. It is really more of an advanced tool.
Re: SMARTY system
Posted: Fri Feb 11, 2011 6:30 pm
by Torniquet
I have started using smarty to build my forum, and although can be complicated, i love it tbh.
like jack said. not really summit for someone just starting out
Re: SMARTY system
Posted: Fri Feb 11, 2011 8:41 pm
by Xaleph
You use SMARTY for a forum? Wow, one application i never figured you could use SMARTY for. Well, you could, but the overhead.. How many templates do you use? I reckon about 6? Overview, table view, detail view, quick reply, new entry? 5?
I found a cool, lightweight template parser the other day, called: Outline. Very small, easy in use and easily implemented. Has about the same basic features as smarty does, without the long dredging syntax.
Anyway, my template pereference goes to xslt so i`m not to be taken seriously here. lol.
Re: SMARTY system
Posted: Sat Feb 12, 2011 1:36 pm
by Torniquet
well its not accually finished yet lol
but yes people have made forums and even CMS software with it. if you know how to utilize it you can use it to build anything you would normaly without it.
and if you really wanted to, you could use a single template, but it would get very very messy.
I only have my registration page complete currently, but so far i have 4 templates, one master which holds the css/style info, javascript paths etc. asn index template a regisration template (which is split into 3 pages) and an email template.
www.project-blackwidow.com
Re: SMARTY system
Posted: Sat Feb 12, 2011 2:05 pm
by Xaleph
Well, i`m not saying it`s not possible, but given that forums are always based on input from users, you cannot cache it well, which is one of the main reasons to use a template. Since user content always changes over time, this means that, either you cache too much, or you cache nothing at all. Since the content is always loaded from external resources like a database. Hence the caching is not an option.
Which leads to the next question: why bother using a template engine if you are not going to use the main features provided by a template engine? Does it not make sense to just use regular files for the loading? You can still create a template structure, the only thing you would miss is the "easy" syntax for dislpaying variables. Which in SMARTY terms is not that easy anyway. Unless you only work with static vars where $username = "Xaleph"; and you call the {$username}