How To Use

History Key

  • New content
  • Removed content

Recent Versions

Choose two versions to compare, or click the link to view it.

  1. 16. about 3 years by igormoreno
  2. 15. about 3 years by blaine
  3. 14. about 3 years by blaine
  4. 13. about 3 years by blaine
  5. 12. about 3 years by blaine
  6. 11. about 3 years by blaine
  7. 10. about 3 years by blaine
  8. 9. about 3 years by blaine
  9. 8. about 3 years by blaine
  10. 7. about 3 years by blaine
  11. 6. about 3 years by blaine
  12. 5. about 3 years by blaine
  13. 4. about 3 years by blaine
  14. 3. about 3 years by blaine
  15. 2. about 3 years by blaine
  16. 1. about 3 years by blaine
 

ThereYou iscan use Code to Diagram in two waysways:

Locally

Diagram todisplayed usein the code to diagram into your project

Locally

 

Diagram to screenbrowser

Into the bootstrap file insert thisthese command:commands:

<?php

// code to diagram { //

require_once( '../../public/codetodiagram.php');
CodeToDiagram::
getInstance()->start();

// } end code to diagram  //

(...)

your code here

(...)

?>

Remember that:that   thethe "../../public/codetodiagram.php" must be the valid relative path to acess your file.

With just this command you will see the diagram when you run your program.code.

 

<?php

//Diagram codesaved to diagram { //

require_once( '../../public/codetodiagram.php' );
CodeToDiagram::getInstance()->start();

// } end code to diagram //

// regular page { //

require_once( 'Wolf.class.php' );
require_once( 'Pig.class.php' );
require_once( 'House.class.php' );
require_once( 'History.class.php' );

new History();

// } end regular page //

?>


Diagram To Filefile

If you want to save the diagram result into a separated file, you can config the class CodeToDiagram like this:

<?php

(...)// code to diagram { //

require_once( '../../public/codetodiagram.php');
CodeToDiagram::getInstance()->setOutputType( 'file' );  // can be"file"or "screen"


CodeToDiagram::getInstance()->setFileName( 'myfile.html' ); // se the filename of diagram

(...)

?>

So, we can change the old example to save the diagram into a file:

<?php

// code to diagram { //

require_once( '../../public/codetodiagram.php' );


CodeToDiagram::getInstance()->setOutputType('file');

CodeToDiagram::getInstance()->setFileName( 'sequence.html' );

CodeToDiagram::getInstance()->start();

// } end code to diagram //

// regular page { //

require_once( 'Wolf.class.php' );
require_once( 'Pig.class.php' );
require_once( 'House.class.php' );
require_once( 'History.class.php' );

new History();

// } end regular page // //

?>(...)

your code here

(...)

 

?>

You can also generate a diagram of just part of a code execution

Diagram of Stretchpart of Executionan execution

<?php

// code to diagram include { //

require_once( '../../public/codetodiagram.php' );

CodeToDiagram::getInstance()->start();

// } end of the code to diagram include //

// start of regular page { //

require_once( 'Wolf.class.php' );
require_once( 'Pig.class.php' );
require_once( 'House.class.php' );
require_once( 'History.class.php' );

// start the first diagram { //

CodeToDiagram::getInstance()->restart(); // clear the diagram history //

CodeToDiagram::getInstance()->setOutputType( 'file' );

CodeToDiagram::getInstance()->setFileName( 'diagram1.html' );

$objPig = new LitllePig();

$objPig->say( "Hello there!!" );

CodeToDiagram::getInstance()->save();

// } end of the first diagram //

// start of no diagram code { //

$objPig->say( "This will be a secret" );

// } end of no diagram code //

// start of second diagram { //

CodeToDiagram::getInstance()->restart(); // clear the diagram history //

CodeToDiagram::getInstance()->setOutputType( 'file' );

CodeToDiagram::getInstance()->setFileName( 'diagram2.html' );

$objPig = new LittlePig();

$objPig->say( "This will be saved" );

CodeToDiagram::getInstance()->save();

// } end of second diagram //

// } end of regular page //

?>


RemoteRemotely

 

Still in development.

Should work just like the local acess, without the no need to download the code:

<?php

// code to diagram { //

require_once( 'http://code.assembla.com/codetodiagram/subversion/node/blob/_start.php' );
CodeToDiagram::getInstance()->start();

// } end code to diagram //

// regular page { //

require_once( 'Wolf.class.php' );
require_once( 'Pig.class.php' );
require_once( 'House.class.php' );
require_once( 'History.class.php' );

new History();

// } end regular page //

?>

 

Results

 

The diagram generated will be a html with javascript what describe the execution. Some style changes are under development and some new informations as show the code line of the message should be add soon.

To see some example this example page will create this diagram.