Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Keep user content contained

  • 26-09-2010 4:23pm
    #1
    Registered Users, Registered Users 2 Posts: 4,475 ✭✭✭


    A part of my CMS uses user-generated templates to display data. Itr's all well and good if the template is correct, with opening div's, closing div's, proper syntax all that. But if the template has say one too many </div>'s it interferes with the page I'm displaying the data on (so the template's last </div> is actually closing my main div causing display issues).

    Other than a iframe or (shudder) a popup is there any way of isolating this kind of thing such that it will display on the page but not interfere with its containers?


Comments

  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    corblimey wrote: »
    A part of my CMS uses user-generated templates to display data. Itr's all well and good if the template is correct, with opening div's, closing div's, proper syntax all that. But if the template has say one too many </div>'s it interferes with the page I'm displaying the data on (so the template's last </div> is actually closing my main div causing display issues).

    Other than a iframe or (shudder) a popup is there any way of isolating this kind of thing such that it will display on the page but not interfere with its containers?

    That makes little sense, TBH.

    If the template has one too many </div>s, then take it out.
    If the content has one too many </div>s, then take that out.

    If every item of content closes its own tags, then you won't encounter a problem.


  • Registered Users, Registered Users 2 Posts: 4,475 ✭✭✭corblimey


    That's all well and good when it's my own code, but the template can be edited by the user, so I have very little control over it. I don't expect them to validate it and the chances of a rogue </div> or a misspelled </span> cocking up my page are higher than I'd like. If it works locally for them then it should work on the site.


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    Haven't tried this, but might help you

    http://htmlpurifier.org/


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    corblimey wrote: »
    That's all well and good when it's my own code, but the template can be edited by the user, so I have very little control over it. I don't expect them to validate it and the chances of a rogue </div> or a misspelled </span> cocking up my page are higher than I'd like. If it works locally for them then it should work on the site.

    Are they editing the template through the CMS? If so you could parse their html to find unclosed tags and insert them.


  • Registered Users, Registered Users 2 Posts: 4,475 ✭✭✭corblimey


    They have the ability to edit it in-situ, but they can also slap together their own html, broke as it may be, and upload that. I'll take a look at that HTML Purifier thing, my CMS is PHP5, so it might blend in nicely.


  • Advertisement
Advertisement