Invenzzia »

Pages: [1]   Go Down
  Print  
Author Topic: OPTv2: loading a view from DB instead of file  (Read 733 times)
Description: OPTv2 integration with a wiki engine
0 Members and 2 Guests are viewing this topic.
anw
User

Offline Offline

Posts: 2


View Profile
« on: August 30, 2009, 12:06:51 »

Hi,

First of all, congratulations for your incredible work. I'm really impressed, this project looks extremely well designed, coded and documented.

I'm in charge of a multilingual wiki engine based on XML contents, which are stored in database.
In order to allow a few dynamic operations in wiki contents (loops, conditions, external contents fetching and inclusions...) I implemented a basic XML-based logic syntax.
Unfortunately this is a quick&dirty work, and I need something more powerful.

It seems that OPTv2 would feet my needs without too much overhead, for handling wiki's dynamic contents parsing/rendering. However, OPT seems designed to handle XML-templates read from the file system only :
Code:
$view = new Opt_View('example.tpl');

I wonder how hard it would be to allow constructing a view directly from a template-content (and eventually giving a name to identify it - and retrieving it from cache) ? Maybe something like this :
Code:
$view = new Opt_View($wikiPageName);
if (!$view->cacheExists()) {
$view->setContent($wikiPageContent);
}

Do you think it's something possible, without too much hacks ? Is Opt_View the only class reading template from file system, or may it be done in other places too ?

Thanks in advance, and keep up great work!
Logged
eXtreme
Invenzzia
Administrator
User
*****
Offline Offline

Posts: 129

Jacek Jędrzejewski


View Profile WWW
« Reply #1 on: August 30, 2009, 12:46:57 »

Hi! Thanks for your words, we are glad you like OPT2.

OPT2 supports different sources for templates without any hacks. You just have to register a new stream in php:
http://docs.php.net/manual/en/book.stream.php
and then use it in Opt_View.

An example of stream usage can be found in "dev" files on our SVN:
http://svn.invenzzia.org/browser/OpenPowerLibraries/components/Opt/branches/2.0/dev/test_paths_2.php
Logged

anw
User

Offline Offline

Posts: 2


View Profile
« Reply #2 on: August 30, 2009, 17:33:09 »

Wow, this is great news, I'll try in this way! Thanks for the quick answer.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: