PDA

Ver versión completa : Componentes: Using a custom image in the Menu Bar title


gustavo
18-07-2007, 12:57 AM
Using a custom image in the Menu Bar title

To use a custom image in the Menu Bar title we need an image (obviously) and a little bit of css.
First off, create the following folders in your administrator component (we’re using a ficticious component called com_notes as the example). Then place your image in the images folder and create a new file called default.css in the css folder, like this:
Folder Structure
com_notes
|- assets
..|- css
....|- default.css
..|- images
....|- logo.png
The code for the css file looks like this:
default.css
/* Toolbar */

.icon-48-notes {
background: url(../images/logo.png) no-repeat left;
}

Next we tell the menubar handler function to use this css by the following invocation of the title method of JMenuBar:
JMenuBar::title( JText::_( 'Notes List' ), 'notes' ); Notice that value of the second argument, notes, marries with the suffix of the css class.
Finally we need to load the component custom css file. Place the following code typically near the top of admin.notes.php:
$document =& JFactory::getDocument();
$document->addStyleSheet('/components/com_notes/assets/css/default.css'); You can, of course, use default.css for more than just the title styling.

javiparati
19-08-2007, 05:02 PM
Tomo la traducción,
tiempo estimado 72 horas

javiparati
19-08-2007, 05:22 PM
Para usar una imagen personalizada en el título de la Barra de Menú necesitamos obviamente una imagen y un poco de código css.
En primer lugar, crea las siguientes carpetas en tu administrador de componentes (estamos usando como ejemplo un componente ficticio llamado com_notes). Entonces coloca tu imagen en la carpeta de imágenes: "images", y crea un nuevo fichero llamado default.css en la carpeta de los archivos de estilo: "css", como en el siguiente ejemplo:

Estructura de la carpeta:
com_notes
|- assets
..|- css
....|- default.css
..|- images
....|- logo.png El código para el archivo css contiene lo siguiente:
Default css
/* Toolbar */

.icon-48-notes {
background: url(../images/logo.png) no-repeat left;
}
A continuación vamos a decirle a la función que gestiona la Barra de Menú que use ese css mediante la siguiente “invocación de método de título” de JMenuBar:
JMenuBar::title( JText::_( 'Notes List' ), 'notes' ); Fíjate que el valor del segundo argumento, notes, casa con el sufijo de la clase en el css.

Finalmente necesitamos cargar el fichero css personalizado para el componente. Coloca el siguiente código como se suele hacer, cerca del inicio de admin.notes.php:
$document =& JFactory::getDocument();
$document->addStyleSheet('/components/com_notes/assets/css/default.css'); Por supuesto puedes usar default.css para más usos y no únicamente para darle estilo al título.

clslecys
20-05-2008, 05:34 AM
Nice topic, nice article, we have nice ffxi gil (http://www.ffxigilstore.com) and wow gold (http://www.1-wowgold.com)

clslecys
20-05-2008, 11:42 PM
Nice topic, nice article, we have nice ffxi gil (http://www.ffxigilstore.com) and world of warcraft gold (http://www.1-wowgold.com)

beijmanli
22-05-2008, 01:33 AM
A friend is never known till a man has need-------------------------We provide all WoW Gold (http://www.wow-powerleveling.org) services. You can buy WoW Gold (http://www.gogoer.com) Cheap WoW Gold here!Welcome to our website for you World of Warcraft Gold,WoW Gold (http://www.wowgoldlive.com),Cheap World of Warcraft Gold,buy cheap WoW Gold (http://www.gamelee.com),real WoW Gold,sell WoW Gold (http://www.xowow.com),