[Error]  [Ayuda] Agregar cosas al panel de administracion
* URL del foro: localhost * Versión del foro: 1.6 * Actualización: Ninguna Hola bueno ando haciendo pruebas en localhost de un plugin que quiero c...

  • URL del foro: localhost
  • Versión del foro: 1.6
  • Actualización: Ninguna

Hola bueno ando haciendo pruebas en localhost de un plugin que quiero crear para themes.soportemybb pero me preguntaba si alguien sabe como sacar todos los themes en una tabla como en tablas y estilos??

miren lo que ise es crear esto
[Imagen: 33trmdw.png]

Tambien les dejo como llevo mi plug espero que si saben me ayuden ya que nunca habia hecho esto en un plugin jeje de echo para saberlo tube que buscar los hooks en sus respectivos php's!!

[spoiler=Plugin:]
Código PHP:
<?php

$plugins
->add_hook("admin_load""ThemeLink_admin");
$plugins->add_hook("admin_style_menu""ThemeLink_admin_nav");
$plugins->add_hook("admin_style_action_handler""ThemeLink_action_handler");
function 
ThemeLink_info()
{
    return array(
        
"name"        => "Theme Link",
        
"description"    => "to access links to the tables and capture in the DB",
        
"website"        => "http://www.soportemybb.com",
        
"author"        => "Edson Ordaz",
        
"authorsite"    => "http://www.soportemybb.com",
        
"version"        => "Private"
    
);
}


function 
ThemeLink_activate()
{
    global 
$db$mybb;    
    
$db->query("ALTER TABLE `".TABLE_PREFIX."themes` ADD `themelink` TEXT NULL AFTER `name`");

    
rebuild_settings();

}

function 
ThemeLink_deactivate()
{
    global 
$mybb$db;
    
$db->query("ALTER TABLE ".TABLE_PREFIX."themes DROP `themelink`");
    
rebuild_settings();
}

function 
ThemeLink_action_handler(&$action)
{
    
$action['Theme_Link'] = array('active' => 'Theme_Link''file' => '');
}

function 
ThemeLink_admin_nav(&$sub_menu)
{
    global 
$mybb;
    
$Name "Theme Link";
    
$Url "Theme_Link";
        
end($sub_menu);
        
$key = (key($sub_menu))+10;
        
        if(!
$key)
        {
            
$key '110';
        }
        
        
$sub_menu[$key] = array('id' => $Url'title' => $Name'link' => "index.php?module=style/Theme_Link");

}

function 
ThemeLink_admin()
{
    global 
$mybb$db$page$cache$Name;
    
$Name "Theme Link";
    
$Url "Theme_Link";
    if(
$page->active_action != $Url)
    {

        return;
    }

    
$page->add_breadcrumb_item($Name);
    
$page->output_header($Name);

    
$table = new Table;
    
$table->construct_header("Aqui abajo que muestre todos los temas como en estilos", array("width" => "100%"));
    
$table->construct_row();

    
$table->output($Name);
    
$page->output_footer();

}

?>
[/spoiler]
Última modificación: 26 Nov, 2010, 3:29 pm por Cluster.
No lo probe, pero tiene que funcionar:
Código PHP:
function ThemeLink_admin()
{
    global 
$mybb$db$page$cache$Name;
    
$Name "Theme Link";
    
$Url "Theme_Link";
    if(
$page->active_action != $Url)
    {
        return;
    }

    
$page->add_breadcrumb_item($Name);
    
$page->output_header($Name);

    
$table = new Table;
    
$table->construct_header("Theme", array("width" => "80%"));
    
$table->construct_header("Link", array("class" => "align_center""width" => "20%"));
    
    
$themes cache_themes();
    
// print_r($themes);
    
foreach($themes as $theme)
    {
        
$table->construct_cell($theme['name']);
        
$table->construct_cell('<a href="somefile.php?theme_id=' $theme['tid'] . '" title="Link">Link</a>');
        
$table->construct_row();
    }

    
$table->output($Name);
    
$page->output_footer();

Código:
Fatal error: Call to undefined function cache_themes() in C:\xampp\htdocs\1600\inc\plugins\ThemeLink.php on line 111

Este error lo manda al entrar ala tabla creada!!
Yo lo habia hecho igual pero habia puesto en donde pusiste cache_themes() puse cache_styles() pero tampoco :S:S
Agrega esta linea arriba de la llamada a la función:
Código PHP:
require_once MYBB_ADMIN_DIR."inc/functions_themes.php"
Última modificación: 23 Nov, 2010, 5:04 pm por ExplosiveMan.
[Imagen: 11qsi9y.png]




[Imagen: f3x0mg.png]
Última modificación: 23 Nov, 2010, 5:28 pm por LeoNeL =D.
Ah, si, parece que el último valor es el ID del theme activo.
Esto pasa por no probar las cosas :p
Código PHP:
function ThemeLink_admin()
{
    global 
$mybb$db$page$cache$Name;
    
$Name "Theme Link";
    
$Url "Theme_Link";
    if(
$page->active_action != $Url)
    {
        return;
    }

    
$page->add_breadcrumb_item($Name);
    
$page->output_header($Name);

    
$table = new Table;
    
$table->construct_header("Theme", array("width" => "80%"));
    
$table->construct_header("Link", array("class" => "align_center""width" => "20%"));
    
    require_once 
MYBB_ADMIN_DIR."inc/functions_themes.php"
    
$themes cache_themes();
    unset(
$themes['default']);
    foreach(
$themes as $theme)
    {
        
$table->construct_cell($theme['name']);
        
$table->construct_cell('<a href="somefile.php?theme_id=' $theme['tid'] . '" title="Link">Link</a>');
        
$table->construct_row();
    }

    
$table->output($Name);
    
$page->output_footer();

Bien ahora funciona agregare la opcion escribir, guardar y editar donde guarde en un campo que cree en la DB espero me funcione ya que como dije antes nunk habia manejado este tipode cosas...

Una vez mas grax