Fri, 29 August 2008
Home
Articles
Books
Search
Tools
Whois
Links
Sitemap
Contact us
Privacy policy
Home arrow Articles arrow Mambo arrow Mambo Component Tutorial

Mambo Component Tutorial PDF Print E-mail
Articles - Mambo
Article Index
Mambo Component Tutorial
Frontend files
Administration files
Class files
Installation files
Appendix A. mosMenuBar
Appendix B. getPath
Class files
  • mycomp.class.php (optional)
    Class file mycomp.class.php contains other helper functions that are shared between frontend and adminstration files. For example, you can have a function that returns query result here and another function in mycomp.html.php to use this result, parse, and display the data nicely in a table. You can put this file either in 'installdir/components/mycomp' (Mambo will look here first) or 'installdir/administrator/components/mycomp' and include it from frontend or administration files using the following line:

    <?php
    require_once($mainframe->getPath('class'));
    ?>

Of course you can have other files than those explained here. For example, Awesom! component has Smarty templates included for easier customization of the layout. However, you cannot use $mainframe->getPath() to include the files since Mambo does not have the keys for this.

<?php
// Example how to include other helper file
// $mosConfig_absolute_path is the full path 
// to Mambo installation directory
require_once($mosConfig_absolute_path.'/components/mycomp/helper1.php');
?>


 

Powered by
Syndicate