Skip to content

How to use this plugin to override the frontend com_content category view, blog layout #1

Description

@LiliwoL

Hi,

and thanks for that plugin, i tried to write my own to override view.html.php, and i didn't succeed.

So i installed yours, but it is limited to administration side.

Could you tell how to use it for frontend side and to another view (category) ?

I changed layout.php as:
function onAfterInitialise(){
var_dump(JFactory::getApplication()->input->get('option', '', 'cmd'));

    /** Set criteria for the View you want to override */
    if (JFactory::getApplication()->input->get('option', '', 'cmd') == 'com_content'
        && JFactory::getApplication()->input->get('view', '', 'cmd') == 'category'
        && JFactory::getApplication()->input->get('layout', '', 'cmd') == 'blog'
    ) {

        /** Override JRequest View and Layout - register the view (example in the layout/com_content folder) */
        JRequest::setVar('view', 'article2');
        JRequest::setVar('layout', 'blog2');
        JLoader::register('ContentViewArticle2', __DIR__ . '/com_content/views/article/ContentViewArticle2.php');
    }

}
}

But the var_dump never displays anything...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions