Dynamic content engine for Smarty
| From: | Ville Aho | Date: | Wed, 02 Jan 2002 17:45:08 +0000 |
| Subject: | Dynamic content engine for Smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2463@lists.php.net to get a copy of this message | ||
Dynamic content engine for Smarty
Hi all,
I've been developing a dynamic content management framework using Smarty
for some months now. Sorry not to inform you about this earlier, but the
product, called webDynamo is not on a release stage yet. We're planning to
release it as opensource GPL later this year, when the interface has got
standardised and everything more stable.
The basic idea of webDynamo is to provide a high-level interface for
basic dynamic developing tasks such as creating, modifying and removing
data, checking for input, authentication, mailing forms and so on, while
maintaining good possibilities for customizing interface and hiearchies.
We already have a number of libraries and projects being developed with
Webdynamo. Shortly all the libraries will be available for testing and
reference in our upcoming website. Also more documentation and references
will be added.
We'd be happy to share the source with the Smarty developers and welcome
new developers to the project. If you're interested let us know. The project
is not public yet, so there's not too much info but I just thought that it's
good for you to know about this.
The (early) README is at below.
Thanks for a great product, keep going!
With cooperative regards,
Ville Aho
email: ville@kulma.net
webDynamo:
Email: dev@webdynamo.org.
WWW: http://webdynamo.org
----
README
Webdynamo - Dynamic Content Management System
v0.47
Template-based content management system for
dynamic development in the web.
Requires: PHP 4, MySQL, Smarty 1.45
(www.php.net, www.mysql.com, www.phpinsider.com)
*1. FEATURES
-Fast: Templates are compiled into runnable scripts.
Cache can also be used, which greatly improves performance
especially with heavy load.
-Customizable: Interface and hierarchies are based on
modular templates which can be easily edited, giving control of the
interface to developer. All is controlled by the templates
(and setup file) so there's no need to mess up with code.
-Effective: Without writing a single line of code, one can
develop interactive database applications. There is many
modules available which can easily be use and modified to needs.
-Extensible: You can easily include your own functions if needed.
There are some general functions available. However, for the
sake of maintainability, custom functions are avoided if not needed.
Instead new general functions are to be added if there's wider
need.
*2. INSTALLATION
2.1. PEAR must be in PHP include path:
Set in PHP.ini or use function in top of dynamo.php:
ini_set("include_path","/usr/local/lib/php")
2.2. chown $member/tpl_c and $member/cache to httpd-owner because Smarty
needs to write here.
2.3. Prepare a demo installation to try it out:
-Add demonstration data to your database:
mysqladmin create dynamo -udynamo -p
mysql <demo/sql/all.sql -udynamo -p
edit demo/setup.inc to your configuration
(database,user,etc)
2.4. Try it out.
Examples at:
WWW: yourhost.com/dynamo-directory/demo
*3. VARIABLES
$member = Which directory to use for setup, templates, etc
$lib = template library to use (see $tpl)
$lib_cat= which library to use categories with
$cmd = which template to include (see $tpl)
$method = used if many sections inside $cmd, eq. update
$tpl = template to run ($tpl = $lib-$cmd.tpl). Used internally.
*4. MANIFEST
4.1. dynamo/
dynamo.php
-Wrapper, including functions and setup, assign variables,
displaying template
- URL aliasing: parsing the URL, domain.net/$tpl/$cmd/?$extra
core.inc
- Core functions to call directly from templates
func.inc
- Helper functions needed by template functions
auth.inc
- Authentication library
extra.inc
- Extra functions
global.inc
- Global settings, TODO
4.2. dynamo/smarty - Smarty template engine. v. 1.4.5
4.3. dynamo/$member - Member configuration files, templates, SQL-dumps
- setup.inc - configuration settings, database, mailing, check, etc
- tpl/ - templates & template libraries .TPL
- cache/ - cache files (chown www-data.www.data)
- tpl_c/ - precompiled templates (chown www-data.www-data)
- sql/ - database schemas
4.4. dynamo/demo
mentioned, sql, setup, tpl
see LIBRARIES for list and specs
5. TEMPLATE FUNCTIONS
** core.inc - Core template functions
--exe -function wrapper, checks if secure, calls function
PARAMS: cmd=$function, +other params needed in func
EXAMPLE: {exe cmd="listing" lib="tekstit"}
--listing -getting data based on parameters, assigning for smarty
PARAMS: lib, priority, limit, order, num, cat
EXAMPLE: {exe cmd="listing" lib="tekstit" priority="$priority"
limit="$limit" num="$num" order="$order" cat="$cat"}
--add_form -getting data for FORM values if update
PARAMS: lib
EXAMPLE: {exe cmd="add_form" lib=tekstit}
--del -deleting data
PARAMS: id, lib
EXAMPLE: {exe cmd="del" id=$id lib=$lib}
--add -adding data, checking that everything set, adding to db
PARAMS: add, lib, id, +extra params if needed (not set in HTTP_POST)
EXAMPLE: {exe cmd="add" lib=tekstit id="$id" priority="3"}
MISC:
--pass_md5 -creating and passing md5-encrypted version of string
PARAMS: password (???) generalize?
EXAMPLE: {exe cmd="pass_md5" password=$smarty.get.password}
--auth-login (user_name=$smarty.get.user_name);
--auth-logout
--do_nl2br($content) converts \n to <BR>
--n2p converts($content) converts \r to "", \n\n to </P><P>
6. WEBDYNAMO PROCESS
6.1. HTTP REQUEST: Apache get HTTP request, loads alias wrapper
script, which loads dynamo
dynamo.php:
<Files vai>
ForceType application/x-httpd-php
</Files>
vai:
<?php
$member = "member";
chdir ("/home/ville/kulma.net/www/dynamo");
include "dynamo.php";
?>
6.2. PARSING URL: Dynamo parses URL to check which member, lib
and cmd to use + extra URL data.
---checking authentication
6.3. Check if in cache, include setup plus functions, display template
6.4. Load template $member/tpl/$lib-$cmd.tpl
6.5. Execute functions in template, eg. {exe cmd="listing"} which does
database query and assings variables for template.
6.6. Display data.