Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8374965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:03:28+00:00 2026-06-09T15:03:28+00:00

I need to install a component I created on my joomla 2.5 version. The

  • 0

I need to install a component I created on my joomla 2.5 version.
The instalation requiers me to add an html folder in the default template (templates/templatename/html/com_test/viewname/default.php) in order to overide another component.
So how can I specify in the instalation xml or in the instalation.php script
to add a folder containing some other folders and files in the default template of the joomla instalation?

I also need to mention that this is the code of my installation.php file.This is how I have made it so far but still I cant figure out why the folder is not coppied. I think the source is wrong since it is in the zip file that I am trying to install

<?php
defined('_JEXEC') or die('Restricted access');

/**
 * Script file of HelloWorld component
 */
class com_helloWorldInstallerScript
{
    /**
     * method to install the component
     *
     * @return void
     */
    function install($parent) 
    {

        $db = JFactory::getDBO();
        $query = "
                SELECT ".$db->nameQuote('template')."
                FROM ".$db->nameQuote('#__template_styles')."
                WHERE ".$db->nameQuote('client_id')." = 1 and ".$db->nameQuote('home')." = 1;
              ";
        $db->setQuery($query);
        $AdminTemplate = $db->loadResult();

        $query = "
                SELECT ".$db->nameQuote('template')."
                FROM ".$db->nameQuote('#__template_styles')."
                WHERE ".$db->nameQuote('client_id')." = 0 and ".$db->nameQuote('home')." = 1;
              ";
        $db->setQuery($query);
        $SiteTemplate = $db->loadResult();

        $src = "/viewnamenew";
        $destination = JPATH_SITE."/templates/".$SiteTemplate ."/html/com_test/viewname";
        JFolder::copy($src, $destination);
    }

    /**
     * method to uninstall the component
     *
     * @return void
     */
    function uninstall($parent) 
    {
        // $parent is the class calling this method
        echo '<p>' . JText::_('COM_HELLOWORLD_UNINSTALL_TEXT') . '</p>';
    }

    /**
     * method to update the component
     *
     * @return void
     */
    function update($parent) 
    {
        // $parent is the class calling this method
        echo '<p>' . JText::_('COM_HELLOWORLD_UPDATE_TEXT') . '</p>';
    }

    /**
     * method to run before an install/update/uninstall method
     *
     * @return void
     */
    function preflight($type, $parent) 
    {
        // $parent is the class calling this method
        // $type is the type of change (install, update or discover_install)
        echo '<p>' . JText::_('COM_HELLOWORLD_PREFLIGHT_' . $type . '_TEXT') . '</p>';
    }

    /**
     * method to run after an install/update/uninstall method
     *
     * @return void
     */
    function postflight($type, $parent) 
    {
        // $parent is the class calling this method
        // $type is the type of change (install, update or discover_install)
        echo '<p>' . JText::_('COM_HELLOWORLD_POSTFLIGHT_' . $type . '_TEXT') . '</p>';
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:03:30+00:00Added an answer on June 9, 2026 at 3:03 pm

    You will need to use a installation.php file.

    If you want to create a folder and then copy files inside of it, it will go something along these lines

    $destination = JPATH_SITE."/templates/templatename/html/com_test/viewname";
    JFolder::create($destination);
    JFile::move($src, $dest);
    

    JPATH_SITE is just the Joomla default directory. $src is the directory of the file you’ve installed with the component and $dest is going to be JPATH_SITE.”/templates/templatename/html/com_test/viewname” again.

    Alternatively (and probably better) you can just write the files inside installation.php by:

    jimport('joomla.filesystem.file');
    $file=JPATH_SITE."templates/templatename/html/com_test/viewname/default.php";
    $buffer="Text to put into the file"
    JFile::write($file, &$buffer)
    

    And this will create the folders necessary, without having to use JFolder at all.

    Please note if you are creating some folders thought, you should put in some blank index.html files – although you should be easily able to copy some of these from your component!

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think pbear's component HTML Components, v 9.45, is just what I need. His
I need a simple and flexible component for free to install in my website.
I need to install some CPAN modules in a linux box which I do
I need to install a USB driver for a device so that it is
I need to install a MySql server on my Windows machine to run a
I need to install Rails 2.3.2 and Rails 2.3.4 simultaneously on my Ubuntu 9.04
I need to install mysql on the system. As usual I typed in gem
I need to install a piece of software with a lot of files. Our
I need to install ckeditor in a rails project. I need a page with
I need to install MySQL 5.1 for my rails application. Using Homebrew, I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.