0

I want to add a popup and a trigger for that popup in com_users( i.e Users page) and load a external link into that popup. I have added a button next to the "Add a note" button but i am new to joomla so i don't know how to add popup functionality to it. I have read that it is not recommended to change the core files in Joomla, is this also a core file ? What is the best way to do it.

  • Hello @Aravind and welcome to JSE. From your question it's not clear what are you trying to achieve. Adding buttons and actions to admin interface is not an easy task even for skilled Joomlers. It requres creating a copy of admin template, then creating view overrides of specific components and/or modules, something which requires decent understanding of how everything works. What is your exact intention, there might be some extension which could help you to do it faster and easier. – Mikan Feb 29 '16 at 9:56
  • Hello Mirko, Thank you for your response. I want to load an external page in the admin users page. So i thought, i'll have a button similar to add a note button and upon clicking it a popup will open and in that popup the external webpage can be linked. Is there any plugin through which i can achieve this or what is the best possible way to do it ? – Aravind Feb 29 '16 at 12:04
  • @Anibal just gave you the great answer below. Unfortunately I am not aware of any extension on Joomla Extension Directory which would help you to achieve what you want, and I'm following JED since 2007. – Mikan Feb 29 '16 at 12:37
3

To avoid core file modification, you can introduce views overrides in the same way than front-end views. The /administrator area has its own /administrator/templates. Then, you can add view overrides in /administrator/templates/html.

Ref: Understanding Output Overrides

About popups, you can implement any general popup routine. If you want to follow the Joomla-way to generate popup, this is a sample code:

JHtml::_('bootstrap.modal');

?>
<ul class="nav">
    <li class="divider"></li>
    <li>
        <a  onclick="return false;"
            title="<?php echo JText::_('MOD_EXTENSION_MENU_BUTTON'); ?>"
            href="#myextension_menu_modal"
            role="button"
            data-toggle="modal"
            class="btn btn-small btn-primary visible-desktop visible-tablet">

            <img src="../media/com_myextension/images/myextension-icon.png">
            <?php echo JText::_('MOD_EXTENSION_MENU_BUTTON'); ?>
        </a>
    </li>
</ul>
<?php

    $document = JFactory::getDocument();
    $document->addScriptDeclaration("
    // Joocial menu
    if (!window.xtModalClose) {
        window.xtModalClose = function() {
                jQuery('div.modal').modal('hide');
        };
    };
    ");

    $modal_dialog = JHtmlBootstrap::renderModal(
                'myextension_menu_modal',
                array(
                    'url' => $link,
                    'title' => JText::_('MOD_EXTENSION_MENU_BUTTON'),
                    'height' => '400px',
                    'width' => '500px',
                    'class' => 'myextension_menu_modal'
                )
        );
    echo $modal_dialog;

    $document->addScriptDeclaration("
    jQuery(window).ready(function() {
        jQuery('#myextension_menu_modal').appendTo(\"body\");
    });
    ");
  • I have one doubt here, that administrator has its default template and when we go for joomla upgrade so that template will also be upgraded. So, the override will no longer exist. Therefore, after Joomla update how can we preserve our overide? – Liz. Mar 1 '16 at 4:38
  • Files inside /html folder are not modified in upgrades. That's why overrides are so important ;-) – Anibal Mar 1 '16 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.