01-25-2021, 01:50 PM
(Última modificación: 02-06-2024, 04:23 PM por Chctrpgo.
Razón: Captura GIF y DEMO agregado
)
10
DEMODebes agradecer para ver el contenido...
Captura gif
[img]Registrate o inicia tu sesión para ver este contenido[/img]
En header.php
Buscar:
Código PHP: ( Seleccionar Todo )
// Configuraciones
$smarty->assign('tsConfig',$tsCore->settings);
Debajo agregar:
Código PHP: ( Seleccionar Todo )
// Configuraciones
$smarty->assign('tsThemes',$tsCore->getThemes());
En c.core.php --> inc --> class --> c.core.php
Buscar:
Código PHP: ( Seleccionar Todo )
function __construct()
{
// CARGANDO CONFIGURACIONES
$this->settings = $this->getSettings();
$this->settings['domain'] = str_replace('http://','',$this->settings['url']);
$this->settings['categorias'] = $this->getCategorias();
$this->settings['default'] = $this->settings['url'].'/themes/default';
$this->settings['tema'] = $this->getTema();
$this->settings['images'] = $this->settings['tema']['t_url'].'/images';
$this->settings['css'] = $this->settings['tema']['t_url'].'/css';
$this->settings['js'] = $this->settings['tema']['t_url'].'/js';
//
if($_GET['do'] == 'portal' || $_GET['do'] == 'posts') $this->settings['news'] = $this->getNews();
# Mensaje del instalador y pendientes de moderación #
$this->settings['install'] = $this->existinstall();
$this->settings['novemods'] = $this->getNovemods();
}
Reemplazar por:
Código PHP: ( Seleccionar Todo )
function __construct()
{
// CARGANDO CONFIGURACIONES
$this->settings = $this->getSettings();
$this->settings['domain'] = str_replace('http://','',$this->settings['url']);
$this->settings['categorias'] = $this->getCategorias();
$this->settings['default'] = $this->settings['url'].'/themes/default';
if(!isset($_COOKIE['tema']) || !file_exists(TS_ROOT.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.$_COOKIE['tema'])) {
$default = db_exec('fetch_array', db_exec(array(__FILE__, __LINE__), 'query', 'SELECT * FROM w_temas WHERE tid = '.$this->settings['tema_id']));
$_COOKIE['tema'] = $default['t_path'];
}
$this->settings['tema']['t_path'] = $_COOKIE['tema'];
$this->settings['tema']['t_url'] = $this->settings['url'].'/themes/'.$this->settings['tema']['t_path'];
$this->settings['images'] = $this->settings['tema']['t_url'].'/images';
$this->settings['css'] = $this->settings['tema']['t_url'].'/css';
$this->settings['js'] = $this->settings['tema']['t_url'].'/js';
//
if($_GET['do'] == 'portal' || $_GET['do'] == 'posts') $this->settings['news'] = $this->getNews();
# Mensaje del instalador y pendientes de moderación #
$this->settings['install'] = $this->existinstall();
$this->settings['novemods'] = $this->getNovemods();
}
Buscar:
Código PHP: ( Seleccionar Todo )
/*
getNews()
*/
function getNews()
{
//
$query = db_exec(array(__FILE__, __LINE__), 'query', 'SELECT not_body FROM w_noticias WHERE not_active = \'1\' ORDER by RAND()');
while($row = db_exec('fetch_assoc', $query)){
$row['not_body'] = $this->parseBBCode($row['not_body'],'news');
$data[] = $row;
}
//
return $data;
}
Debajo agregar:
Código PHP: ( Seleccionar Todo )
/*
getThemes()
*/
function getThemes(){
$query = db_exec(array(__FILE__, __LINE__), 'query', 'SELECT * FROM w_temas');
return result_array($query);
}
En c.smarty.php --> inc --> class --> c.smarty.php
Buscar:
Código PHP: ( Seleccionar Todo )
function __construct()
{
global $tsCore;
//
$this->template_dir = TS_ROOT.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.TS_TEMA.DIRECTORY_SEPARATOR.'templates';
$this->compile_dir = TS_ROOT.DIRECTORY_SEPARATOR.'cache';
$this->template_cb = array('url' => $tsCore->settings['url'], 'title' => $tsCore->settings['titulo']);
//
$this->_tpl_hooks = array();
}
Reemplazar por:
Código PHP: ( Seleccionar Todo )
function __construct()
{
global $tsCore;
//
$this->template_dir = TS_ROOT.DIRECTORY_SEPARATOR.'themes'.DIRECTORY_SEPARATOR.TS_TEMA.DIRECTORY_SEPARATOR.'templates';
$this->compile_dir = TS_ROOT.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.TS_TEMA;
if(!file_exists($this->compile_dir)) mkdir($this->compile_dir);
$this->template_cb = array('url' => $tsCore->settings['url'], 'title' => $tsCore->settings['titulo']);
//
$this->_tpl_hooks = array();
}
Importante: Ahora este código debe estar en todas la plantillas, si no, solo se podría cambiar el theme desde una plantilla y desde las otras no.
Ejemplo en el footer
Buscar:
Código PHP: ( Seleccionar Todo )
<a href="{$tsConfig.url}/pages/dmca/">Report Abuse - DMCA</a>
Debajo agregar:
Código PHP: ( Seleccionar Todo )
<a class="blanco" onclick="change.menu();">Cambiar plantilla</a>
<style>
{literal}
.change_option { display: block; padding: 10px 15px; border-bottom: 1px solid #ccc; }
.change_option:first-child { border-top: 1px solid #ccc; }
.change_option:hover { background: #444; color: white; }
{/literal}
</style>
<script>
{literal}
var change = {
menu: function() {
mydialog.show();
mydialog.title('Cambiar plantilla');
mydialog.body('{/literal}{foreach from=$tsThemes item=t}<a class="change_option" onclick="change.theme({$t.tid})">{if $tsConfig.tema.t_path == $t.t_path}<img src="{$tsConfig.images}/tick-button.png" style="vertical-align: middle;">{/if} {$t.t_name}</a>{/foreach}{literal}');
mydialog.buttons(true, true, 'Cancelar', 'close', true);
mydialog.center();
},
theme: function(id) {
$.get(global_data.url+'/change.php?theme='+id).done(function() { window.location.reload(); });
}
};
{/literal}
</script>
Y subir esta carpeta
Mega
Debes agradecer para ver el contenido...
Google Drive
Debes agradecer para ver el contenido...
Mediafire
Debes agradecer para ver el contenido...
Creditos: Debes agradecer para ver el contenido...





Facebook
Twitter
Reddit
Digg
del.icio.us
Tumblr
Pinterest
Blogger
Fark
LinkedIn
Mix
Google