Moderators Kyle Posted July 8, 2010 Moderators Report Posted July 8, 2010 Ok, i'm not sure what is the php code JUST! to display a template. Does anyone know what it is, please. Thanks! Quote
Guest lorathon Posted July 8, 2010 Report Posted July 8, 2010 If you are attempting to display the template from a module then the code is Template::Show('xxxxxx.tpl'); Quote
Moderators Kyle Posted July 8, 2010 Author Moderators Report Posted July 8, 2010 If you are attempting to display the template from a module then the code is Template::Show('xxxxxx.tpl'); Thanks! but i'm not sure how to fully php it, there's got to be more than that. Quote
Guest lorathon Posted July 8, 2010 Report Posted July 8, 2010 Ok here we go.... We will write a new module call TemplateX Module Code - Module will be named TemplateX.php and be put into the TemplateX folder in the core/modules folder <?php class TemplateX extends CodonModule { public function index() { Template::Show('TemplateX.tpl'); } } ?> Template - named TemplateX.tpl put into the core/templates folder <?php // do you php code here ?> <!---- HTML code here ---> To call the module you would http://www.yoursite.com/index.php/TemplateX That will pull up the TemplateX template Quote
Moderators Kyle Posted July 8, 2010 Author Moderators Report Posted July 8, 2010 One Point for you Jeff! Thanks Man! Quote
Guest lorathon Posted July 8, 2010 Report Posted July 8, 2010 No problem Vansers. You can also load variables into your template using the module <?php class TemplateX extends CodonModule { public function index() { $total_flights = StatsData::TotalFlights(); Template::Set('total_flights', $total_flights); Template::Show('TemplateX.tpl'); } } ?> In the template you can then use those variables that have been loaded. <?php echo $total_flights; ?> Quote
TAV1702 Posted July 8, 2010 Report Posted July 8, 2010 This is interesting. Did you ever get it to work out right? Quote
Guest lorathon Posted July 8, 2010 Report Posted July 8, 2010 TAV, If you need any help with something like this let me know. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.