templates?

61 views
Skip to first unread message

webpied

unread,
Oct 16, 2011, 8:38:01 AM10/16/11
to GluePHP
i know Joe either told me about templates or (i think) showed me an
example. i see a link that is including smartypants.php. however, it
seems i remember seeing 'smarty' tpl somewhere.
Joe, if you answer this - do you recommend smarty or something else
(twig? etc...)
tia,
greg

webpied

unread,
Oct 16, 2011, 4:21:20 PM10/16/11
to GluePHP
found it - got it to work
http://gluephp.com/glueandsmarty.html

any suggestions for setting up static files? i'm sure it's just a
preference but using all these libraries in a stack makes me wonder if
there is a 'best practice' for handling the labraries, static files/
etc...

Joe

unread,
Oct 17, 2011, 7:13:47 PM10/17/11
to GluePHP
Hi Greg,

> any suggestions for setting up static files?  i'm sure it's just a
> preference but using all these libraries in a stack makes me wonder if
> there is a 'best practice' for handling the labraries, static files/
> etc...

The example mod_rewrite code for your .htaccess file will handle
static files:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php

The !-f and !-d lines basically say that unless the file or directory
exists, send everything to index.php. Therefore if the file and
directory do exist, process them as normal. So your static files are
automatically handled.

Thanks,
Joe

Greg Milby

unread,
Oct 18, 2011, 1:04:48 PM10/18/11
to glu...@googlegroups.com
Hi Joe,

Regrettably, I did not explain myself well and wasted your time.

Just the folder layout - i did not know if there was a "better practice for where to place each class directory" inside the web structure - when to instantiate/disconnect/flush (or w/e php does to free up resources(?)).

right now, i have
.htaccess
index.php
/lib/glue.php
/lib/smarty/->lots of smart stuff o.0

i'm curious about where to put the layout files (in my python world it would be /static/js/, static/css/, static/files/, static/images/).

as for resources - i've been doing a lot with mongo/php lately - it seems after a read/a $connection->disconnect(); is in order to free up resources.

Thanks for answering,
Greg

Joe

unread,
Oct 18, 2011, 9:43:22 PM10/18/11
to GluePHP
Hi Greg,

My opinion is that this is more of a choice for the programmer to make
than something that should be dictated. I personally have all
libraries and templates outside of the DocumentRoot, but that is just
my preference.

Thanks,
Joe

On Oct 18, 11:04 am, Greg Milby <gmi...@gmail.com> wrote:
> *Hi Joe,
>
> **Regrettably, **I did not explain myself well and wasted your time.
>
> Just the folder layout - i did not know if there was a "better practice for
> where to place each class directory" inside the web structure - when to
> instantiate/disconnect/flush (or w/e php does to free up resources(?)).
>
> right now, i have
> .htaccess
> index.php
> /lib/glue.php
> /lib/smarty/->lots of smart stuff o.0
>
> i'm curious about where to put the layout files (in my python world it would
> be /static/js/, static/css/, static/files/, static/images/).
>
> as for resources - i've been doing a lot with mongo/php lately - it seems
> after a read/a $connection->disconnect(); is in order to free up resources.
>
> Thanks for answering,
> Greg
> *

Greg Milby

unread,
Oct 19, 2011, 8:59:04 AM10/19/11
to glu...@googlegroups.com
That's good.  i've just learned to ask if there are any gotcha's before i start building a sand castle in low tide.  took decades of experience to make me smart enough to assume i know nothing. haha
Reply all
Reply to author
Forward
0 new messages