Important

You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Client Side Navigation

Client Side Navigation allows to load page in different formats HTML or JSON in depends on request. First request form browser loads complete HTML page. All following requests are made by JavaScript and load page blocks in JSON format.

To get the page ready for the client side navigation, follow the steps below:

  • Add an additional check in main layout template:

{% if not oro_is_hash_navigation() %}
<!DOCTYPE html>
<html>
...
[content]
...
</html>
{% else %}
{# Template for hash tag navigation#}
{% include 'OroNavigationBundle:HashNav:hashNavAjax.html.twig'
    with {'script': block('head_script'), 'messages':block('messages'), 'content': block('page_container')}
%}
{% endif %}

where:

block(‘head_script’) -a block with a page related javascripts; block(‘messages’) - a block with system messages; block(‘page_container’) - a content area block (without header/footer) that is reloaded during navigation

  • To exclude links from processing with client side navigation (like windows open buttons, delete links), add an additional css class “no-hash” to the tag, e.g.

<a href="page-url" class="no-hash">...</a>

As part of the navigation, form submit is also processed with Ajax.