If you could add something to Kentico, what would it be and why?

Add area at the bottom of Master page

Hello

On a Master page (portal site) we would like to add some JS to the bottom on different pages. It would be really useful to have a field/area/zone that could be used. So that we could put anything we want and this area would put what we wanted just before the closing HTML Body tag.

Thanks

Ilesh Mistry

55 votes
Vote
Sign in
(thinking…)
Password icon
Signed in as (Sign out)
You have left! (?) (thinking…)
Ilesh Mistry shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

6 comments

Sign in
(thinking…)
Password icon
Signed in as (Sign out)
Submitting...
  • Kile commented  ·   ·  Flag as inappropriate

    We do this in our templates by using two page placeholders in the master page. Any extra JavaScript that's needed for a template is placed in the second page placeholder. In the master page the page placeholder is added under the other site wide JavaScript files (jquery, etc) so the order is correct.

  • Ilesh Mistry commented  ·   ·  Flag as inappropriate

    Hi Radek

    Sure no worries, I will try to explain here.

    The ordering of JS is really important. Basically we all know JS should be placed at the bottom in the Master page, on a Portal Template approach. So we can add this to the bottom just before the closing Body tag. So imagine I did this.

    Now for page templates, different pages etc... I want to run some JS code, but this code would run before the code we placed in the Master page. Due to JS requiring things to run in an order, this would mean we would need to try and do something different to make our code run.

    This is why I was suggesting to have a field/zone/area (not sure exactly what yet), but this would appear on all Templates/Pages, so then you can say Page 1 will run this Code A, Page 2 can run Code B.

    I am hoping this is all making sense.

    That is so far for pages, but there is no reason why we can't also have it for Page Templates. So if you add a web part of some sort then it knows to sit at the bottom, under everything else. Just like the Head HTML web part works, you can add this to any zone, but it know exactly where to put the content!

    We should look to create two things...
    1) Create a Form Controls field, that if added as a field in Document Types, it would allow someone to put some JS to be inserted to the bottom of the page.
    2) Create a Footer web part, that would allow people to add JS to the web part to be included at the bottom of the page below the items in the Master Page. This would be exactly the same as the Head HTML web part, but be for the footer instead. This would be my preferred option.

    I would be really happy to help progress this with you and really believe we need to find a solution to JS ordering. I think this is pretty urgent and would save us amending the PortalTemplate.aspx file and other Kentico core files for this.

    Thanks

    Ilesh

  • Ilesh Mistry commented  ·   ·  Flag as inappropriate

    Hi Dominik

    Sorry, no the JS may just be for certain page templates, not for all. However should be available for all templates.

    Ilesh

Feedback and Knowledge Base