PHP-Nuke
  Strona głównaDownloadForumFAQ Zaloguj się  
 Menu
 Home :
 Strona główna
 Demo PHPNuke
 Archiwum
 Użytkownicy :
 Ekipa phpnuke.org.pl
 Lista Użytkowników
 Prywatne wiadomości
 Online
 Menu :
 Regulamin
 Kontakt
 Linki
 Download
 Dokumentacja :
 FAQ
 Idiots Guide
 Polecamy
» domy drewniane
 Tools
 Module Creator
 Block Creator
 HTML to PHP
 HTML to Javascript
 Online HTML Editor
 Meta Tag Creator
 Popup Creator
 Scrollbar Creator
 Hex Colors
 Previewer
 HTML Encoder
 URL Encoder
 Rot-13 Encoder
 DB Generator
 MD5 Calculator
 Top Themes
1.Tesko1123
2.BLock759
3.ICGstation595
4.Dw-Advance487
5.Fiblack3d467
6.ZoneBlue434
7.Cobalt361
8.Aeolus349
9.PH2BLUE332
10.XPMidnight315
The Complete Idiots Guide to Nuke  v.3.2

Idiots Guide Home Page
About PHP-Nuke
Installation
The Administration panel
Add-On types
Forums
Developers Guide to Nuke
Troubleshooting
Useful Links
Development Home
Globals and Common Functions
Modules Development
Theme Development
Blocks Development
Admin Section Development
Database Integration

Blocks Development

Blocks development, although it does share many properties with modules as far as they're still programmed in PHP, doesn't actually display content in the same way. Nor do they have pages or use many functions.

Getting Started

With blocks, the start of the file shares some properties with modules. The following code demonstrates what an example block's file might look like:

<?php

/**********************/
/* Your credits go here     */
/**********************/

if(!eregi("block-blockname.php", $_SERVER['PHP_SELF'])){
     header("Location: index.php");
}

$content = "";


These 3 lines:

if(!eregi("block-blockname.php", $_SERVER['PHP_SELF'])){
     header("Location: index.php");
}


basically redirect anybody who tries to access that block file directly to the index.php of the site.

Adding Content to the Blocks

Unlike modules, you don't add content to blocks by using an echo command.

To add content to a block, you use the $content variable and add stuff to it. (which is why there's always a $content = ""; at the top of every block underneath the other stuff I mentioned in the Getting Started section).

To add content to a block, the code might look like this:

$content .= "Your Content goes here";


You must always make sure there's a .= not just a = between $content and the "

This is because it then forces whatever's in between the "s to be added to whatever's in the $content variable already, rather than overwriting it.

You might now be wandering to yourself "But how does the $content variable display anything on screen unless it's in an echo statement somewhere?". The answer to this is simple.

Unlike Modules, blocks' overall layout is controlled in the theme, not the block itself. When a block is loaded, the theme loads the content of the block using an echo command that calls the $content variable when it's supposed to be.

Anything that's within an echo line inside the block files actually gets displayed above the block. Funny feature that, but it's how it goes because of the nature of the theme controlling the block.

Languages in Blocks

Languages in blocks are not the same as languages in modules. There isnt a seperate directory to store language variables for blocks, so they all pull the language from the main language file ( /language/lang-english.php ), so any definitions you need to include need to go in that file.

Last Updated: July 6th 2003
 

Copyright © 2004-2009 by phpnuke.org.pl :: PHP-Nuke Copyright © 2004 by Francisco Burzi.
Zdjęcia ślubne
Tworzenie strony: 0.42 sekund
Zapytań: 10