This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » [beginner] how to be sure to get the...
expandshrink

[beginner] how to be sure to get the location id

[beginner] how to be sure to get the location id

Tuesday 09 September 2014 5:01:45 pm - 1 reply

Hi everyone, I'm a complete beginner in EZ and I'm trying to do basic things on EZ 5.x

I'm having a hard time fiding help or accurate docs so please don't be rude if my questions are silly !

I would like to develop a breadcrumb in my main layout (pagelayout.html.twig) so I decided to call a controller in this layout, and to pass it the location id in order to retrieve the entire path.

But I have noticed that I did'nt always had the location var nor the locationId in my main template. How can I manage to be sure of getting a setted var with the location id every time ? 

Friday 12 September 2014 7:12:27 am

Hi,

You do not always have a location object available (ie: when accessing login page) therefore you should always check <% if location is defined %> in your template before using it.

You only have a location when you try to access a content object (a page, an article, a feedback form,...).

Hakim

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from