PHP code example of getinstance / listingtools

1. Go to this page and download the library: Download getinstance/listingtools library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

getinstance / listingtools example snippets


/* listing 001.01 */
    public function getMatches()
    {
        return $this->output;
    }
/* /listing 001.01 */

/* listing 001.02 */
    public function reset()
    {
        $this->reading = [];
        $this->output = [];
    }
/* /listing 001.02 */

    public function getMatches()
    {
        return $this->output;
    }

    

/* listing 001.02  */  
print "This is my example code\n";

// ...
/* /listing 001.02  */  

print "here is some boilerplate that is not relevant\n";

/* listing 001.02  */  

print "I return to my listing\n";
/* /listing 001.02  */ 

print "This is my example code\n";

// ...

print "I return to my listing\n";

/* listing 001.07  */  
/* listing 001.05  */  
print "An initial listing element\n";
/* /listing 001.05  */  
/* listing 001.06  */  
print "A new, related, listing element\n";
/* /listing 001.06  */  

print "An initial listing element\n";

print "A new, related, listing element\n";

print "An initial listing element\n";
print "A new, related, listing element\n";

/* listing 001.08 chop */
print "Remove the gulf that comes after";




/* /listing 001.08  */

    print "A new, related, listing element\n";

    

$ php listingtools/scripts/doindex.php myrepo/

doindex.php <file_or_dir>

$ doindex src/

001.01: 
    src/output/Parser.php
001.02: 
    src/output/Parser.php

gencode.php [options] <project> <srcdir> <chapterfile.md> [<output.md>]

$ vendor/bin/gencode.php -d testproj . chapter.md 

001.00.01
001.01
001.02
001.03

nextlist.php <article-id> <dir>

$ php scripts/nextlist.php 001 .
/* listing 001.05 */
/* /listing 001.05 */

output.php <srcdir> <listingno>

renum.php <dir>

001.01: 
    ./one.php
001.02: 
    ./one.php
001.03: 
    ./two.php

001.00.01: 
    ./one.php
001.01: 
    ./one.php
001.03: 
    ./two.php

$ renum .
001.00.01 -> 001.01
   ./test.md
   ./one.php
001.01 -> 001.02
   ./test.md
   ./one.php
no change: 001.03

/* listing 001.03 */

print "listing code goes here\n";

/* /listing 001.03 */

# listing 001.03

print "listing code goes here\n";

# /listing 001.03