Jump to content

How to dispaly a add on


Kyle

Recommended Posts

  • Moderators

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.

Link to comment
Share on other sites

Guest lorathon

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

Link to comment
Share on other sites

Guest lorathon

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;

?>

Link to comment
Share on other sites

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...