Usando os parâmetros do componente

From Basef
Revision as of 14:29, 9 September 2015 by Admin (Talk | contribs) (Criou página com 'Arquivo config.xml do componente: <source lang="html"> <?xml version="1.0" encoding="utf-8"?> <config> <params> <param name="parametro1" type="textarea" default="valorpa...')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Arquivo config.xml do componente:

Linguagem inválida.

Você precisa especificar uma linguagem, tal como: <source lang="html4strict">...</source>

Linguagens suportadas no realce de sintaxe:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, aimms, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, c_winapi, caddcl, cadlisp, cfdg, cfm, chaiscript, chapel, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, cpp-winapi, csharp, css, cuesheet, d, dart, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, ezt, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, javascript, jcl, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nginx, nimrod, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, postscript, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, qml, racket, rails, rbs, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, rust, sas, scala, scheme, scilab, scl, sdlbasic, smalltalk, smarty, spark, sparql, sql, standardml, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vbscript, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


<?xml version="1.0" encoding="utf-8"?>
<config>
    <params>
	<param name="parametro1" type="textarea" default="valorpadrao1" label="label1" description="Descrição 1" rows="5" cols="50"  />
	<param name="parametro2" type="text" default="valorpadrao2" label="label2" description="Descrição 2" cols="50"  />
	<param name="parametro3" type="textarea" default="valorpadrao3" label="label3" description="Descrição 3" rows="5" cols="50"  />
	<param name="parametro4" type="textarea" default="valorpadrao4" label="label4" description="Descrição 4" rows="5" cols="50"  />
	<param name="parametro5" type="text" default="valorpadrao5" label="label5" description="Descrição 15" cols="50"  />
    </params>
</config>

Lendo os dados na view do componente:

$params =& $mainframe->getPageParameters('com_componentname');
$p1 = $params->get('parametro1', 'valorpadrao1');
$p2 = $params->get('parametro2', 'valorpadrao2');
$p3 = $params->get('parametro3', 'valorpadrao3');
$p4 = $params->get('parametro4', 'valorpadrao4');
$p5 = $params->get('parametro5', 'valorpadrao5');

Para fazer aparecer o botão Preferências na barra de ferramentas do back-end:

JToolBarHelper::title( JText::_( 'Título da barra de ferramentas' ), 'generic.png' );
JToolBarHelper::preferences('com_componentname', '400');