Исходный текст | Переводы |
---|---|
Ampersand | Signo & |
Greater than | Pli granda ol |
Less than | Malpligrandaj ol |
Quotation mark | Citilo |
Character Description | Priskribo de la simbolo |
No HTML tags allowed | HTML tegoj estas malpermesitaj |
You may post PHP code. You should include <?php ?> tags. | Vi rajtas uzi PHP kodon. Vi devas inkluzivi <?php ?> etikedojn. |
![]() <h4>Using custom PHP code</h4> ![]() <p>If you know how to script in PHP, Drupal gives you the power to embed any script you like. It will be executed when the page is viewed and dynamically embedded into the page. This gives you amazing flexibility and power, but of course with that comes danger and insecurity if you do not write good code. If you are not familiar with PHP, SQL or with the site engine, avoid experimenting with PHP because you can corrupt your database or render your site insecure or even unusable! If you do not plan to do fancy stuff with your content then you are probably better off with straight HTML.</p> ![]() <p>Remember that the code within each PHP item must be valid PHP code - including things like correctly terminating statements with a semicolon. It is highly recommended that you develop your code separately using a simple test script on top of a test database before migrating to your production environment.</p> ![]() <p>Notes:</p><ul><li>You can use global variables, such as configuration parameters, within the scope of your PHP code but remember that global variables which have been given values in your code will retain these values in the engine afterwards.</li><li>register_globals is now set to <strong>off</strong> by default. If you need form information you need to get it from the "superglobals" $_POST, $_GET, etc.</li><li>You can either use the <code>print</code> or <code>return</code> statement to output the actual content for your item.</li></ul> ![]() <p>A basic example:</p> ![]() <blockquote><p>You want to have a box with the title "Welcome" that you use to greet your visitors. The content for this box could be created by going:</p> ![]() <pre> ![]() print t("Welcome visitor, ... welcome message goes here ..."); ![]() </pre> ![]() <p>If we are however dealing with a registered user, we can customize the message by using:</p> ![]() <pre> ![]() global $user; ![]() if ($user->uid) { ![]() print t("Welcome $user->name, ... welcome message goes here ..."); ![]() } ![]() else { ![]() print t("Welcome visitor, ... welcome message goes here ..."); ![]() } ![]() </pre></blockquote> ![]() <p>For more in-depth examples, we recommend that you check the existing Drupal code and use it as a starting point, especially for sidebar boxes.</p> | ![]() <h4>Uzante agordigan PHP-kodon</h4> ![]() <p>Se vi scipovas skripti en PHP, Drupalo donas al vi potencon enmeti ajnan skripton laŭ via plaĉo. Ĝi funkcios kiam oni vizitas la paĝon kaj dinamike inkluziviĝos en la paĝo. Tio donas al vi nekredeble grandan flekseblecon kaj potencon, sed kompreneble, tio venas kun danĝero kaj malsekurecon se vi ne skribas bonan kodon. Se vi ne konas PHP-n, SQL-n, aŭ la reteja sistemo, evitu eksperimenti kun PHP, ĉar vi povas korupti vian datumbazon aŭ malsekurigi vian retejon aŭ eĉ tute detrui ĝin! Se vi ne planas eksterordinaraĵojn kun via enhavo, tiam verŝajne pli bonas uzi simplan HTML-n.</p> ![]() <p>Memoru ke la kodo ene de ĉiu PHP-ero devas esti valida PHP-kodo - inkluzivante aferojn kiel korekte fini diraĵojn kun punktokomo. Estas forte rekomendata ke vi programu vian kodon aparte kun simpla testa skripto ĉe test-datumbazo antaŭ ol migri al la produkta sistemo.</p> ![]() <p>Rimarkoj:</p><ul><li>Vi povas uzi globalajn variablojn, kiel la agordaj parametroj, ene de la konteksto de via PHP-kodo, sed memoru ke globalaj variabloj kiuj havas valorojn en via kodo, retenos tiujn valorojn en la sistemo poste.</li><li>register_globals nun havas valoron de <strong>malŝaltita</strong> defaŭlte. Se vi bezonas formularajn informojn, vi devas preni ĝin de la "superglobalaj" $_POST, $_GET ktp.</li><li>Vi povas uzi la ordonon de <code>print</code> aŭ <code>return</code> por eligi la veran enhavon por via ero.</li></ul> ![]() <p>Baza ekzemplo:</p> ![]() <blockquote><p>Vi volas havi kampon kun la titolo "Bonvenon" kiun vi povas uzi por saluti viajn vizitantojn. Oni povas krei la enhavon por ĉi tiu kampo uzante:</p> ![]() <pre> ![]() print t("Bonvenon vizitanto, ... bonveniga mesaĝo ĉi tie ..."); ![]() </pre><p>Se ni tamen traktas kun registrita uzanto, ni povas agordi la mesaĝon uzante:</p> ![]() <pre> ![]() global $user; ![]() if ($user->uid) { ![]() print t("Bonvenon $user->name, ... bonveniga mesaĝo ĉi tie ... "); ![]() } ![]() else { ![]() print t("Bonvenon vizitanto, ... bonveniga mesaĝo ĉi tie ..."); ![]() } ![]() </pre></blockquote> ![]() <p>Por pli profundaj ekzemploj, ni rekomendas ke vi kontrolu la ekzistantan Drupal-kodon kaj uzu ĝin kiel komenc-punkton, speciale por flankmenuaj blokoj.</p> |
Lines and paragraphs break automatically. | Lineoj kaj alineoj aŭtomate rompiĝas. |
Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines. | Lineoj kaj alineoj aŭtomate rekoneblas. La <br /> linerompo, <p> alineo kaj </p> fermajn alineajn etikedojn enmetiĝas aŭtomate. Se alineoj ne rekoneblas, simple aldonu kelkajn malplenajn lineojn. |