[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 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
![[Image: 33trmdw.png]](http://i55.tinypic.com/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:]
<?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]
No lo probe, pero tiene que funcionar:
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();
}
Fatal error: Call to undefined function cache_themes() in C:\xampp\htdocs\1600\inc\plugins\ThemeLink.php on line 111Este 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:
require_once MYBB_ADMIN_DIR."inc/functions_themes.php";
![[Image: 11qsi9y.png]](http://i52.tinypic.com/11qsi9y.png)
![[Image: f3x0mg.png]](http://i56.tinypic.com/f3x0mg.png)
Ah, si, parece que el último valor es el ID del theme activo.
Esto pasa por no probar las cosas :p
Esto pasa por no probar las cosas :p
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
Una vez mas grax