Invenzzia »

Pages: [1]   Go Down
  Print  
Author Topic: OPTv2: get template from database  (Read 515 times)
Description: How do I retrieve a template from a database?
0 Members and 2 Guests are viewing this topic.
whumble
User

Offline Offline

Posts: 10


View Profile
« on: September 14, 2010, 17:36:40 »

While reading the manual I found curious thing, that
template could be retrieved from a database:

// File from the database
$view = new Opt_View('database:template.tpl');

It was saying that this syntax uses PHP streams.
How it could be done with a database? Please give me a hint.

Logged
Zyx
Your programmer
Administrator
User
*****
Offline Offline

Posts: 291



View Profile WWW
« Reply #1 on: September 14, 2010, 17:42:58 »

Here you can find some information, how to create a stream wrapper in PHP:

http://docs.php.net/manual/pl/stream.streamwrapper.example-1.php

Basically, stream wrapper is a collection of functions/methods that will be called instead of normal filesystem operations. From the OPT point of view, it looks like reading a file, but internally, your customized "file reading" function accesses the database and retrieves the specified template content from a table.
Logged

PozDrX, Zyx
---Invenzzia group---
whumble
User

Offline Offline

Posts: 10


View Profile
« Reply #2 on: September 14, 2010, 17:51:31 »

Thanks for instant reply.
So I do implement my wrapper by myself.  OK.
Just was wondering if the library could help somehow, but no problem.
Thanks again.
Logged
Zyx
Your programmer
Administrator
User
*****
Offline Offline

Posts: 291



View Profile WWW
« Reply #3 on: September 14, 2010, 19:08:39 »

No. How could the library know the database structure you are using?
Logged

PozDrX, Zyx
---Invenzzia group---
whumble
User

Offline Offline

Posts: 10


View Profile
« Reply #4 on: September 18, 2010, 20:52:41 »

Understood.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Subject Started by Replies Views Last post
OPTv2: kod śledzenia Google Analytics poliman 3 533 Last post December 29, 2009, 19:48:00
by eXtreme
OPTv2: Widoczny prolog w trybie debug i blad wyswietlania strony bez niego. gorky_park 1 599 Last post October 30, 2009, 11:39:13
by Zyx
OPL for Zend Framework ersonic 1 274 Last post March 09, 2011, 21:27:24
by Zyx
OPTv2 : Naprzemienne kolorowanie rekordów El_Darro 7 1808 Last post May 26, 2008, 13:55:07
by megaweb
OPTv2: Znak   zamieniany na krzaczki. mrKrecik 12 4730 Last post November 19, 2010, 08:11:24
by Zyx