Skip to content

Commit

Permalink
examples: Tracy is enabled before output is print; added redirect exa…
Browse files Browse the repository at this point in the history
…mple
  • Loading branch information
dg committed May 30, 2016
1 parent fb0c83e commit 5032f95
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 23 deletions.
5 changes: 5 additions & 0 deletions examples/assets/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
html.arrow {
background: url(arrow.png) no-repeat bottom right;
height: 100%;
}

body {
font: 15px/1.5 Tahoma, sans-serif;
color: #333;
Expand Down
17 changes: 8 additions & 9 deletions examples/barDump.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css">

<style> html { background: url(assets/arrow.png) no-repeat bottom right; height: 100%; } </style>

<h1>Tracy Debug Bar demo</h1>

<p>You can dump variables to bar in rightmost bottom egde.</p>

<?php

require __DIR__ . '/../src/tracy.php';
Expand All @@ -14,8 +6,15 @@

Debugger::enable(Debugger::DEVELOPMENT, __DIR__ . '/log');

$arr = array(10, 20.2, TRUE, NULL, 'hello', (object) NULL, array());
?>
<!DOCTYPE html><html class=arrow><link rel="stylesheet" href="assets/style.css">

<h1>Tracy: bar dump demo</h1>

<p>You can dump variables to bar in rightmost bottom egde.</p>

<?php
$arr = array(10, 20.2, TRUE, NULL, 'hello', (object) NULL, array());

Debugger::barDump(get_defined_vars());

Expand Down
12 changes: 7 additions & 5 deletions examples/dump.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css">

<h1>Tracy Dumper demo</h1>

<?php

require __DIR__ . '/../src/tracy.php';

use Tracy\Debugger;


Debugger::enable(Debugger::DEVELOPMENT, __DIR__ . '/log');

?>
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css">

<h1>Tracy: Dumper demo</h1>

<?php

class Test
{
public $x = array(10, NULL);
Expand Down
10 changes: 6 additions & 4 deletions examples/exception.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css">

<h1>Tracy Exception demo</h1>

<?php

require __DIR__ . '/../src/tracy.php';
Expand All @@ -10,6 +6,12 @@

Debugger::enable(Debugger::DETECT, __DIR__ . '/log');

?>
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css">

<h1>Tracy: exception demo</h1>

<?php

function first($arg1, $arg2)
{
Expand Down
10 changes: 5 additions & 5 deletions examples/fatal-error.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css">

<h1>Tracy Fatal Error demo</h1>

<?php

require __DIR__ . '/../src/tracy.php';

use Tracy\Debugger;


Debugger::enable(Debugger::DETECT, __DIR__ . '/log');

?>
<!DOCTYPE html><link rel="stylesheet" href="assets/style.css">

<h1>Tracy: fatal error demo</h1>

<?php

function first($arg1, $arg2)
{
Expand Down
21 changes: 21 additions & 0 deletions examples/redirect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

require __DIR__ . '/../src/tracy.php';

use Tracy\Debugger;

Debugger::enable(Debugger::DETECT, __DIR__ . '/log');


if (empty($_GET['redirect'])) {
Debugger::barDump('before redirect');
header('Location: ' . $_SERVER['REQUEST_URI'] . '?&redirect=1');
exit;
}

Debugger::barDump('after redirect');

?>
<!DOCTYPE html><html class=arrow><link rel="stylesheet" href="assets/style.css">

<h1>Tracy: redirect demo</h1>

0 comments on commit 5032f95

Please sign in to comment.