Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > Templates > phplib et phpBB
phplib et phpBB Forum d'entraide sur les moteurs de templates phplib et phpBB. Avant de poster -> FAQ gabarits phpBB2, Cours phpBB2 et Sources phpBB2
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 08/10/2005, 17h36   #1
Nouveau Membre du Club
 
Inscription : août 2002
Messages : 113
Détails du profil
Informations forums :
Inscription : août 2002
Messages : 113
Points : 32
Points : 32
Par défaut [phplib] Source du template stocké en base de données

Hello tlm !!

Je voudrait faire des templates, non pas en indiquant un fichier dans lequel il y a un code HTML, mais en balancant directement le code HTML ( que j'aurait pris dans un bdd ...) comment puis je faire cela ?
Stef784ever est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 08/10/2005, 18h08   #2
Expert Confirmé Sénior
 
Homme Mathias Gaunard
Ingénieur développement logiciels
Inscription : décembre 2003
Messages : 3 543
Détails du profil
Informations personnelles :
Nom : Homme Mathias Gaunard
Localisation : France, Essonne (Île de France)

Informations professionnelles :
Activité : Ingénieur développement logiciels

Informations forums :
Inscription : décembre 2003
Messages : 3 543
Points : 4 408
Points : 4 408
Avec une astuce, peut-être.

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
class VariableStream {
   var $position;
   var $varname;
 
   function stream_open($path, $mode, $options, &$opened_path)
   {
       $url = parse_url($path);
       $this->varname = $url["host"];
       $this->position = 0;
 
       return true;
   }
 
   function stream_read($count)
   {
       $ret = substr($GLOBALS[$this->varname], $this->position, $count);
       $this->position += strlen($ret);
       return $ret;
   }
 
   function stream_write($data)
   {
       $left = substr($GLOBALS[$this->varname], 0, $this->position);
       $right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
       $GLOBALS[$this->varname] = $left . $data . $right;
       $this->position += strlen($data);
       return strlen($data);
   }
 
   function stream_tell()
   {
       return $this->position;
   }
 
   function stream_eof()
   {
       return $this->position >= strlen($GLOBALS[$this->varname]);
   }
 
   function stream_seek($offset, $whence)
   {
       switch ($whence) {
           case SEEK_SET:
               if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
                     $this->position = $offset;
                     return true;
               } else {
                     return false;
               }
               break;
 
           case SEEK_CUR:
               if ($offset >= 0) {
                     $this->position += $offset;
                     return true;
               } else {
                     return false;
               }
               break;
 
           case SEEK_END:
               if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
                     $this->position = strlen($GLOBALS[$this->varname]) + $offset;
                     return true;
               } else {
                     return false;
               }
               break;
 
           default:
               return false;
       }
   }
}
 
stream_wrapper_register('var', 'VariableStream');
Ensuite au lieu de mettre ton nom de fichier tu mets var://taVariable
loufoque est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 08/10/2005, 19h58   #3
Nouveau Membre du Club
 
Inscription : août 2002
Messages : 113
Détails du profil
Informations forums :
Inscription : août 2002
Messages : 113
Points : 32
Points : 32
thx, je vai essayer
Stef784ever est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 20h50.


 
 
 
 
Partenaires

Hébergement Web