Home Документация Документи за разработчици How to make our components to add the necessary Content Elements?
How to make our components to add the necessary Content Elements? ПДФ Печат Е-мейл
Написано от Ivo Apostolov   
Четвъртък, 26 Април 2007 00:36
There are no translations available.

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 Stable download

Избрани сътрудници

От екипа на Джум!Фиш (Алекс, Герайнт, Иво & Робин), голямо благодарим към цялата Джум!Фиш общност. Специални благодарност за тестването, предложенията, преводите и модерирането към:

  • Томи Уай за сладкото лого
  • Бернхард, Майкъл, Люк, Оливие, Робин, Руне, Акаравут
  • Хари (Тасу) за модерирането

Recommended Reading

Buy Joomla! 1.5 with directshopper