{"action":"created","issue":{"url":"https://api.github.com/repos/GaryJones/Gamajo-Template-Loader/issues/13","repository_url":"https://api.github.com/repos/GaryJones/Gamajo-Template-Loader","labels_url":"https://api.github.com/repos/GaryJones/Gamajo-Template-Loader/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/GaryJones/Gamajo-Template-Loader/issues/13/comments","events_url":"https://api.github.com/repos/GaryJones/Gamajo-Template-Loader/issues/13/events","html_url":"https://github.com/GaryJones/Gamajo-Template-Loader/issues/13","id":32574892,"number":13,"title":"Load variables in template-loading scope","user":{"login":"GaryJones","id":88371,"avatar_url":"https://avatars.githubusercontent.com/u/88371?v=3","gravatar_id":"","url":"https://api.github.com/users/GaryJones","html_url":"https://github.com/GaryJones","followers_url":"https://api.github.com/users/GaryJones/followers","following_url":"https://api.github.com/users/GaryJones/following{/other_user}","gists_url":"https://api.github.com/users/GaryJones/gists{/gist_id}","starred_url":"https://api.github.com/users/GaryJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaryJones/subscriptions","organizations_url":"https://api.github.com/users/GaryJones/orgs","repos_url":"https://api.github.com/users/GaryJones/repos","events_url":"https://api.github.com/users/GaryJones/events{/privacy}","received_events_url":"https://api.github.com/users/GaryJones/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GaryJones/Gamajo-Template-Loader/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2014-04-30T21:25:43Z","updated_at":"2016-03-13T20:21:35Z","closed_at":null,"body":"Calling in globals, and extracting variables from an array variable, then requiring the template file all in the same scope, so that the non-global variables don't pollute the global scope.\r\n\r\nSee https://github.com/blazersix/simple-image-widget/blob/develop/includes/class-simple-image-widget-template-loader.php#L194\r\n\r\ncc @bradyvercher"},"comment":{"url":"https://api.github.com/repos/GaryJones/Gamajo-Template-Loader/issues/comments/196046201","html_url":"https://github.com/GaryJones/Gamajo-Template-Loader/issues/13#issuecomment-196046201","issue_url":"https://api.github.com/repos/GaryJones/Gamajo-Template-Loader/issues/13","id":196046201,"user":{"login":"cliffordp","id":1812179,"avatar_url":"https://avatars.githubusercontent.com/u/1812179?v=3","gravatar_id":"","url":"https://api.github.com/users/cliffordp","html_url":"https://github.com/cliffordp","followers_url":"https://api.github.com/users/cliffordp/followers","following_url":"https://api.github.com/users/cliffordp/following{/other_user}","gists_url":"https://api.github.com/users/cliffordp/gists{/gist_id}","starred_url":"https://api.github.com/users/cliffordp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cliffordp/subscriptions","organizations_url":"https://api.github.com/users/cliffordp/orgs","repos_url":"https://api.github.com/users/cliffordp/repos","events_url":"https://api.github.com/users/cliffordp/events{/privacy}","received_events_url":"https://api.github.com/users/cliffordp/received_events","type":"User","site_admin":false},"created_at":"2016-03-13T20:21:35Z","updated_at":"2016-03-13T20:21:35Z","body":"How can https://github.com/GaryJones/Gamajo-Template-Loader/tree/template-data be used _inside a shortcode_?\r\n\r\nIf my shortcode generates data and then pulls the appropriate template, `echo` in the template throws the rendered template to the top of the post (like putting `echo` in a regular shortcode). If I `return` in the template to then _add to_ the shortcode's output, it doesn't...\r\n\r\nExample usage (within shortcode):\r\n```\r\n$output = '<div>';\r\n$output .= myClass::load_template( 'hourly_full_vertical', $template_data ); // the template does PHP return, not echo\r\n$output = '</div>';\r\n```\r\nResult:\r\n`<div></div>`\r\n\r\nThanks for the help!"}}