Skip to content

Instantly share code, notes, and snippets.

@jeffreyroberts
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffreyroberts/f330ad4a164adda221aa to your computer and use it in GitHub Desktop.
Save jeffreyroberts/f330ad4a164adda221aa to your computer and use it in GitHub Desktop.
PHP Vars not being passed from bootstrap to view
<?php
/**
* Created by PhpStorm.
* User: jlroberts
* Date: 10/18/14
* Time: 12:42 PM
*/
define('JLR_ROOT', '/vagrant/web');
$siteName = "Jeff's Site";
<?php
include "bootstrap.php";
include "views.php";
JLR_Core_Views::loadView("index");
<?php
/**
* Created by PhpStorm.
* User: jlroberts
* Date: 10/18/14
* Time: 12:43 PM
*/
echo $siteName;
<?php
class JLR_Core_Views {
public static function loadView($templateName) {
$templatePath = JLR_ROOT . '/webroot/' . $templateName . '.tpl';
if(file_exists($templatePath)) {
include_once $templatePath;
}
}
}
@jeffreyroberts
Copy link
Author

Notice: Undefined variable: siteName in /vagrant/web/webroot/index.tpl on line 9

lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment