Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

template.c File Reference

the template library function implementations More...

#include "config.h"
#include "defines.h"
#include <dlfcn.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include "utils.h"
#include "hashlib.h"
#include "template.h"

Go to the source code of this file.

Functions

int tpl_cf_init (t_cf_template *tpl, const u_char *fname)
void tpl_cf_setvar (t_cf_template *tpl, u_char *vname, const u_char *value, int len, int escapehtml)
int tpl_cf_appendvar (t_cf_template *tpl, u_char *vname, const u_char *value, int len)
void tpl_cf_freevar (t_cf_template *tpl, u_char *vname)
void tpl_cf_parse (t_cf_template *tpl)
void tpl_cf_parse_to_mem (t_cf_template *tpl)
void tpl_cf_finish (t_cf_template *tpl)
const t_cf_tpl_variabletpl_cf_getvar (t_cf_template *tpl, u_char *name)


Detailed Description

the template library function implementations

Author:
Christian Kruse, <cjk@wwwtech.de>

Definition in file template.c.


Function Documentation

int tpl_cf_appendvar t_cf_template tpl,
u_char *  vname,
const u_char *  value,
int  len
 

This function appends a string to the value of the specified variable.

Parameters:
tpl The template structure
vname The variable name
value The value to append
len The length of the value
Returns:
0 on success, -1 on error

Definition at line 104 of file template.c.

void tpl_cf_finish t_cf_template tpl  ) 
 

This function destroys a template file structure. It closes the template file, frees the parsed content and destroys the variables.

Parameters:
tpl The template file structure

Definition at line 171 of file template.c.

void tpl_cf_freevar t_cf_template tpl,
u_char *  vname
 

This function unsets a template variable.

Parameters:
tpl The template file structure
vname The variable name

Definition at line 124 of file template.c.

const t_cf_tpl_variable* tpl_cf_getvar t_cf_template tpl,
u_char *  vname
 

This function returns the value of a template variable.

Parameters:
tpl The template file structure
vname The variable name
Returns:
The value of the variable if the variable could be found or NULL
Attention:
You may not free this value! It's done internally by the template engine!

Definition at line 187 of file template.c.

int tpl_cf_init t_cf_template tpl,
const u_char *  fname
 

This function loads a template file and initializes the template structure.

Parameters:
tpl The template structure
fname The filename of the template file. It has to contain the full path!
Returns:
0 on success, -1 on error

Definition at line 58 of file template.c.

void tpl_cf_parse t_cf_template tpl  ) 
 

This function will parse a template file and print out the parsed content. No memory is allocated, this should be very fast.

Parameters:
tpl The template file structure

Definition at line 136 of file template.c.

void tpl_cf_parse_to_mem t_cf_template tpl  ) 
 

This function parses a template file and store the parsed content into the string structure parsed in the template file structure.

Parameters:
tpl The template file structure

Definition at line 154 of file template.c.

void tpl_cf_setvar t_cf_template tpl,
u_char *  vname,
const u_char *  value,
int  len,
int  escapehtml
 

This function sets a template variable to a specified value.

Parameters:
tpl The template structure
vname The variable name
value The value of the variable
len The length of the value
escapehtml Should the characters in the string converted to HTML entities if neccessary?

Definition at line 82 of file template.c.


Generated on Sun Apr 25 16:37:39 2004 for Classic Forum by doxygen 1.3.5