Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of JImmy Bo  >  PHP ROM MUD Area Loader  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example load and display of ROM MUD area file using class
Class: PHP ROM MUD Area Loader
Load ROM MUD area map files into arrays
Author: By
Last change: use of mud to directory function added
Date: 2013-10-05 18:23
Size: 1,062 bytes
 

Contents

Class file image Download
<?php
    
include_once('class.load.rom.area.php');
    
    echo 
'<pre>';

    
$RAL = new rom_mud_area_loader();
    
        
$RAL->show_world();
        
$RAL->world_to_file("test.world.php");

    echo 
'</pre>';


    echo 
'<pre>';

    
$RAL = new rom_mud_area_loader();
    
        
# you can add multiple areas at once like:
    /*
        $RAL->parse_rom_file("areas/rom/school.are");
        $RAL->parse_rom_file("areas/rom/midgaard.are");
        $RAL->parse_rom_file("areas/rom/smurf.are");
        $RAL->parse_rom_file("areas/rom/smurf.are");
        $RAL->parse_rom_file("areas/rom/olympus.are");
        $RAL->parse_rom_file("areas/rom/mirror.are");
    */
        
        # .. or you can add a whole directory (or multiple directories)
        
$RAL->parse_rom_dir("areas/rom/");

        
// $RAL->show_world(); // displays a cleanly formatted array in the browser window.
        
        // $RAL->world_to_file("test.world.php"); // dumps the PHP array to a file
        
$RAL->world_to_dir('test_world/'); // much nicer
        
        // echo $RAL->world_to_json();    // displays a JSON version of the array in the browser window.

    
echo '</pre>';
?>