Jump to content

Recommended Posts

  • Moderators
Posted

Ok, i'm not sure what is the php code JUST! to display a template.

Does anyone know what it is, please. Thanks!

Guest lorathon
Posted

If you are attempting to display the template from a module then the code is

Template::Show('xxxxxx.tpl');

  • Moderators
Posted

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.

Guest lorathon
Posted

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

Guest lorathon
Posted

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;

?>

Guest lorathon
Posted

TAV,

If you need any help with something like this let me know.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...