I want to create new template tags that query the database.
That way I could let the user of the script define their own database
query in the template without the need of editing anything else but
the template.
Such a tag could look something like this:
{database variable=$test
table=tablename
where='id=123'
limit=1
order='id'}
Afterwards the user would use the variable $test to access the
content.
Maybe those helpers could help me do what I want to do?
Yeah, helpers are something different - they were implemented as a
means to support a form builder, which I never finished. I discovered
that this was entirely the wrong way to go about that, so this feature
will not be documented, and in Outline 2.0, this feature has been
removed.
By the way, I would recommend you read up on MVC principles - Outline
was designed as a means to simplify generation of view templates. As
you've discovered, however, I made no attempts to enforce MVC
principles, that's up to the developer - building something like a
database query into a view is a sure way to get your model/controller
logic tangled up in your view code.
If this the first template engine you've worked with, you're probably
tempted to try to wrap up all of your code in little reusable
commands. This is both good and bad. Good because you're having an
important realization for any programmer to have at some point - that
lazyness is a virtue. But bad because you're going about it all wrong
- your database logic has no business floating around in your
templates.
As time goes on, you will realize that while you're apparently making
fast progress ("wow, look, I did this query and printed out the result
with one line of code!") the long term result is unmaintainable messy
spaghetti code.
Why?
Read up on the principles of MVC development.
You'll thank me later :-)