downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

inclued Functions> <Examples
Last updated: Fri, 20 Nov 2009

view this page in

Example that implements inclued into an application

This example demonstrates the process of implementing inclued into an existing application, and viewing the results.

Example #1 Getting the data from inclued

<?php
// File to store the inclued information
$fp fopen('/tmp/wp.json''w');
if (
$fp) {
    
$clue inclued_get_data();
    if (
$clue) {
        
fwrite($fpjson_encode($clue));
    }
    
fclose($fp);
}
?>

Now that some data exists, it's time to make sense of it in the form of a graph. The inclued extension includes a PHP file named gengraph.php that creates a dot file that requires the » graphviz library. However, this form is not required.

Example #2 Example use of gengraph.php

This example creates an image named inclued.png that shows the inclued data.

# First, create the dot file
$ php graphviz.php -i /tmp/wp.json -o wp.dot

# Next, create the image
$ dot -Tpng -o inclued.png wp.dot



add a note add a note User Contributed Notes
Example that implements inclued into an application
david at palepurple dot co dot uk
06-Mar-2009 02:23
The included 'gengraph.php' script expects to read serialized data; therefore a better usage example would be :

<?php
// Add this to the page you want to track includes on
if(is_writeable('/tmp/wp.xx')) {
    if(
function_exists('inclued_get_data')) {
       
$clue = inclued_get_data();
       
file_put_contents('/tmp/wp.xx', serialize($clue));
    }
}
?>

And to generate the human readable graph :

# First, create the dot file
$ php /path/to/inclued-src/gengraph.php -i /tmp/wp.xx -o wp.dot

# Next, create the image
$ dot -Tpng -o inclued.png wp.dot

inclued Functions> <Examples
Last updated: Fri, 20 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites