Jump to:

23581 Posts in 19403 Topics by 2893 members

General Questions

SilverStripe Forums » General Questions » [Solved] Prevent automatic population of head/body tag

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 180 Views
  • esakrielaart
    Avatar
    Community Member
    56 Posts

    [Solved] Prevent automatic population of head/body tag Link to this post

    Hi all,

    I have the problem, in which Silverstripe is just trying to do more than I need. The situation: a forTemplate() method is called on a DataObject, using a template, as

    function forTemplate() {
    return $this->renderWith('template');
    }


    The result of this rendering will be written to a XML file, which is working fine. However, in the template.ss, I have included an <head> and <body> section, and silverstripe automatically populates these with its requirements from the CMS (javascripts, CSS). Can I prevent this some how (other than adding whitespaces to the tag names).

    Kinds regards!
    Maurice

  • kinglozzer
    Avatar
    Community Member
    146 Posts

    Re: [Solved] Prevent automatic population of head/body tag Link to this post

    Hi Maurice,

    If I understand correctly, you should just be able to add the following code snippet before your call to renderWith();:

    Requirements::clear();

    Loz

  • esakrielaart
    Avatar
    Community Member
    56 Posts

    Re: [Solved] Prevent automatic population of head/body tag Link to this post

    Hi there,

    you're absolutely right! This solved my problem, and just that fast

    Thanks,
    Maurice

    180 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.