Home Documentation Developer Docs How to make our components to add the necessary Content Elements?
How to make our components to add the necessary Content Elements? PDF Print E-mail
Written by Ivo Apostolov   
Thursday, 26 April 2007 00:36
OK, you need a simple hack in order to make your component install the necessary content element files, when the component is installed itself.
  1. Put the content element files in a folder named "contentelements" for example
  2. In the function com_install in your file install.component_name.php you need to add the following lines of code:
if (file_exists($mosConfig_absolute_path . '/administrator/components
/com_joomfish/config.joomfish.php'))
{
@rename( "$mosConfig_absolute_path/administrator/components/com_component_name
/contentelements/ce_name.xml",
"$mosConfig_absolute_path/administrator/components/com_joomfish
/contentelements/ce_name.xml");
@rename( "$mosConfig_absolute_path/administrator/components
/com_component_name/contentelements/ce_name2.xml",
"$mosConfig_absolute_path/administrator/components/com_joomfish
/contentelements/ce_name2.xml");
@rmdir ("$mosConfig_absolute_path/administrator/components
/com_component_name/contentelements");
} else { @unlink( "$mosConfig_absolute_path/administrator
/components/com_component_name/contentelements/ce_name.xml" );
@unlink( "$mosConfig_absolute_path/administrator
/components/com_component_name/contentelements/ce_name2.xml" );
@rmdir ("$mosConfig_absolute_path/administrator
/components/com_component_name/contentelements"); }

Basicly this few lines of code, check if Joom!Fish is installed, and if so, it copies the necessary files to the right place. If not it delete the files.

Some advanced features might offer even a function those files to be added on a later stage from your component options, but this is probably the easiest way to have a build-in Joom!Fish Support.

 

0 Comments

Add Comment

Joom!Fish 2.0 RC download

Selected Contributors

From the Joom!Fish Core team (Alex, Geraint, Ivo & Robin) a big thank you to all the people of the JoomFish community!
Special thank's for testing, good suggestions, translations and forum moderation to:

  • Tommy White for the cute logo design
  • Bernhard, Michael, Luc, Olivier, Robin, Rune, Akarawuth
  • Harri <aka tassu> for moderation

Recommended Reading

Buy Joomla! 1.5 with directshopper