Skip to content

Commit

Permalink
Use a constant for inline mode
Browse files Browse the repository at this point in the history
  • Loading branch information
scottchiefbaker committed Oct 25, 2022
1 parent b2353a3 commit 718e3da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/060_inline_mode.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
$s->assign("name", "Jason Doolis");
$s->assign("turtles", ["Michelangeo", "Donatello", "Leonardo", "Raphael"]);

print $s->fetch("INLINE");
print $s->fetch(SLUZ_INLINE);

////////////////////////////////////////////////////

Expand Down
4 changes: 3 additions & 1 deletion sluz.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

////////////////////////////////////////////////////////

define('SLUZ_INLINE', 987123654); // Just a random number

class sluz {
public $version = '0.6';
public $tpl_file = null;
Expand Down Expand Up @@ -192,7 +194,7 @@ public function fetch($tpl_file = "") {
// If we're in simple mode and we have a __halt_compiler() we can assume inline mode
$inline_simple = $this->simple_mode && !$tpl_file && $this->get_inline_content($this->php_file);

if ($tpl_file === "INLINE" || $inline_simple) {
if ($tpl_file === SLUZ_INLINE || $inline_simple) {
$str = $this->get_inline_content($this->php_file);
} elseif (!is_readable($tf)) {
$this->error_out("Unable to load template file <code>$tf</code>",42280);
Expand Down

0 comments on commit 718e3da

Please sign in to comment.