Ver Resposta Única
Antigo 20-02-2007, 09:01 PM
beduino
Webmaster
 
Avatar de beduino
 
Registrado em: Dec 2005
Localização: rio de janeiro
Idade: 51
Postagens: 2,073
Entradas no Blog: 2
Thanks: 60
Thanked 33 Times in 24 Posts
Reputação: 10 @ 176
beduino has a spectacular aura aboutbeduino has a spectacular aura about
Enviar mensagem via Windows Live Messenger para beduino
Talking resource.db.php

o que eu uso eh esse aqui
Código PHP:
<?php
/*
 * Smarty plugin
 * ------------------------------------------------------------- 
 * File:     resource.db.php
 * Type:     resource
 * Name:     db
 * Purpose:  Fetches templates from a database
 * -------------------------------------------------------------
 */
function smarty_resource_db_source($tpl_name, &$tpl_source, &$smarty) {
    if ( !
$tpl smarty_resource_db_tplinfo$tpl_name ) ) {
        return 
false;
    }
    if ( 
is_object$tpl ) ) {
        
$tpl_source $tpl->getVar'tpl_source''n' );
    } else {
        
$fp fopen$tpl'r' );
        
$tpl_source fread$fpfilesize$tpl ) );
        
fclose$fp );
    }
    return 
true;
}

function 
smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, &$smarty) {
    if ( !
$tpl smarty_resource_db_tplinfo$tpl_name ) ) {
        return 
false;
    }
    if ( 
is_object$tpl ) ) {
        
$tpl_timestamp $tpl->getVar'tpl_lastmodified''n' );
    } else {
        
$tpl_timestamp filemtime$tpl );
    }
    return 
true;
}

function 
smarty_resource_db_secure($tpl_name, &$smarty)
{
    
// assume all templates are secure
    
return true;
}

function 
smarty_resource_db_trusted($tpl_name, &$smarty)
{
    
// not used for templates
}

function 
smarty_resource_db_tplinfo$tpl_name ) {
    static 
$cache = array();
    global 
$xoopsConfig;

    if ( isset( 
$cache[$tpl_name] ) ) {
        return 
$cache[$tpl_name];
    }
    
$tplset $xoopsConfig['template_set'];
    
$theme = isset( $xoopsConfig['theme_set'] ) ? $xoopsConfig['theme_set'] : 'default';
    
    
$tplfile_handler =& xoops_gethandler('tplfile');
    
// If we're not using the "default" template set, then get the templates from the DB
    
if ( $tplset != "default" ) {
        
$tplobj $tplfile_handler->find$tplsetnullnullnull$tpl_nametrue);
        if ( 
count$tplobj ) ) {
            return 
$cache[$tpl_name] = $tplobj[0];
        }
    }
    
// If we'using the default tplset, get the template from the filesystem
    
$tplobj $tplfile_handler->find"default"nullnullnull$tpl_nametrue);

    if ( !
count$tplobj ) ) {
        return 
$cache[$tpl_name] = false;
    }
    
$tplobj $tplobj[0];
    
$module $tplobj->getVar'tpl_module''n' );
    
$type $tplobj->getVar'tpl_type''n' );
    
$blockpath = ( $type == 'block' ) ? 'blocks/' '';
    
// First, check for an overloaded version within the theme folder
    
$filepath XOOPS_THEME_PATH "/$theme/modules/$module/$blockpath$tpl_name";
    if ( !
file_exists$filepath ) ) {
        
// If no custom version exists, get the tpl from its default location
        
$filepath XOOPS_ROOT_PATH "/modules/$module/templates/$blockpath$tpl_name";
        
        if ( !
file_exists$filepath ) ) {
            
$tplobj $tplfile_handler->find$tplsetnullnullnull$tpl_nametrue);
            if ( 
count$tplobj ) ) {
                return 
$cache[$tpl_name] = $tplobj[0];
            }
        }
        
    }
    return 
$cache[$tpl_name] = $filepath;
}



?>
logico q faz backup ne?
abraçao
b.

"The Kingdom of God is within you and all around you, not in mansions of wood and stone. Split a piece of wood and I am there; lift a stone and you will find me."
"O reino de Deus esta dentro de você e ao seu redor, não em construções de madeira e pedra. Lasque um pedaço de madeira e estarei lá; erga uma pedra e me encontrarás"



beduino está offline   Responder com Quote