?
avatar brunowego
brunowego
30 Sep 2013

Hello everyone, I try use in URL tmpl=component to show only the component view, but not work in Joomla! 3.2, anybody here know about how proceed to make this works?

http://forum.joomla.org/viewtopic.php?f=706&t=821401&p=3089673#p3089673

avatar brunobatista brunobatista - open - 30 Sep 2013
avatar brunobatista
brunobatista - comment - 30 Sep 2013

I found the problem, in backend works fine but in frontend not works because the JApplicationAdministrator class have a method called render() with this code:

// Get the JInput object
$input = $this->input;

$component = $input->getCmd('option', 'com_login');
$file      = $input->getCmd('tmpl', 'index');

if ($component == 'com_login')
{
   $file = 'login';
}

$this->set('themeFile', $file . '.php');

The JApplicationSite class not have the same code in render() method. If I put this code in JApplicationSite::render() works fine.

Is a security problem use the tmpl=component?

avatar betweenbrain
betweenbrain - comment - 30 Sep 2013

Have you tried something like tmpl=modal with a file named modal.php in the root of your site templates directory?

avatar brunobatista
brunobatista - comment - 30 Sep 2013

Hello @betweenbrain , first thanks to try help me.

If have time take a look in this files:
libraries\cms\application\administrator.php
libraries\cms\application\site.php

The method render() of administrator.php

    /**
     * Rendering is the process of pushing the document buffers into the template
     * placeholders, retrieving data from the document and pushing it into
     * the application response buffer.
     *
     * @return  void
     *
     * @since   3.2
     */
    protected function render()
    {
        // Get the JInput object
        $input = $this->input;

        $component = $input->getCmd('option', 'com_login');
        $file      = $input->getCmd('tmpl', 'index');

        if ($component == 'com_login')
        {
            $file = 'login';
        }

        $this->set('themeFile', $file . '.php');

        // Safety check for when configuration.php root_user is in use.
        $config = JFactory::getConfig();
        $rootUser = $config->get('root_user');

        if (property_exists('JConfig', 'root_user')
            && (JFactory::getUser()->get('username') == $rootUser || JFactory::getUser()->id === (string) $rootUser))
        {
            $this->enqueueMessage(
                JText::sprintf(
                    'JWARNING_REMOVE_ROOT_USER',
                    'index.php?option=com_config&task=application.removeroot&' . JSession::getFormToken() . '=1'
                ),
                'notice'
            );
        }

        parent::render();
    }

The method render() of site.php

    /**
     * Rendering is the process of pushing the document buffers into the template
     * placeholders, retrieving data from the document and pushing it into
     * the application response buffer.
     *
     * @return  void
     *
     * @since   3.2
     */
    protected function render()
    {
        switch ($this->document->getType())
        {
            case 'feed':
                // No special processing for feeds
                break;

            case 'html':
            default:
                $template = $this->getTemplate(true);
                $file     = $this->input->get('tmpl', 'index');

                if (!$this->get('offline') && ($file == 'offline'))
                {
                    $this->set('themeFile', 'index.php');
                }

                if ($this->get('offline') && !JFactory::getUser()->authorise('core.login.offline'))
                {
                    $this->setUserState('users.login.form.data', array('return' => JUri::getInstance()->toString()));
                    $this->set('themeFile', 'offline.php');
                    $this->setHeader('Status', '503 Service Temporarily Unavailable', 'true');
                }

                if (!is_dir(JPATH_THEMES . '/' . $template->template) && !$this->get('offline'))
                {
                    $this->set('themeFile', 'component.php');
                }

                // Ensure themeFile is set by now
                if ($this->get('themeFile') == '')
                {
                    $this->set('themeFile', 'index.php');
                }

                break;
        }

        parent::render();
    }
avatar mbabker
mbabker - comment - 30 Sep 2013

What's happening is that the file isn't being set correctly for all cases in the site application. There's a bunch of conditionals to set the file but not one that would match for component, so that needs to be handled.

avatar brunobatista
brunobatista - comment - 30 Sep 2013

Exact @mbabker! Is a improvement for future releases?

avatar mbabker
mbabker - comment - 30 Sep 2013

Just needs a patch, preferably before we tag beta.

avatar mbabker
mbabker - comment - 30 Sep 2013

Change https://github.com/joomla/joomla-cms/blob/master/libraries/cms/application/site.php#L705 to read $this->set('themeFile', $file . '.php'); and it should be good to go.

avatar betweenbrain
betweenbrain - comment - 30 Sep 2013
Just needs a patch, preferably before we tag beta.

Any ETA for that?

avatar mbabker
mbabker - comment - 30 Sep 2013

Someone patch the line as I suggested and it would most likely be merged today.

avatar betweenbrain betweenbrain - reference | - 30 Sep 13
avatar betweenbrain
betweenbrain - comment - 30 Sep 2013

Done!

avatar brunobatista
brunobatista - comment - 30 Sep 2013

Thanks a lot @betweenbrain :dart:

avatar zero-24 zero-24 - close - 30 Sep 2013
avatar brunobatista brunobatista - close - 30 Sep 2013
avatar betweenbrain
betweenbrain - comment - 30 Sep 2013

Thank you!

avatar mbabker mbabker - reference | - 30 Sep 13
avatar ascotto
ascotto - comment - 10 Nov 2013

Hello, I've just installed a new version of joomla 3.2 (final version) and the modules I wish to have (assigned only to home page menu) only in the front page are displayed always every where. I investigated to figure out why is not working correctly, and for now I did not find any answers.

Does anybody have the same issues?

avatar garyamort garyamort - reference | - 2 Dec 13
avatar garyamort garyamort - reference | - 2 Dec 13
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?
Build staging

Add a Comment

Login with GitHub to post a comment