Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Folkert 82 posts 212 karma points
    Aug 30, 2010 @ 16:51
    Folkert
    0

    Create masterpage with package

    I'm not very experienced with creating packages but I was wondering if it is possible to create files/masterpages with the use of a usercontrol(loaded after installation of a package).

    I've created a usercontrol wich writes a file to the filesystem, which is running fine when not used as a package. When I load the usercontrol after installation of the package, nothing happens. So, I'm wondering if it'sis possible and if so, what am I missing and where can I find more information about fireing events in the usercontrol after package installation.

  • Jamie Howarth 306 posts 773 karma points c-trib
    Aug 30, 2010 @ 17:34
    Jamie Howarth
    0

    Hi Folkert,

    Try this:

    using umbraco.cms.businesslogic.template;

    public partial class MyUserControl : System.Web.UI.UserControl {
    protected void Page_Load() {
    if (!IsPostBack) {
    Template mytemplate = Template.MakeNew("myNewTemplateName", User.GetUser(0)); /* This is the root admin user */
    }
    }

    You can then use the Template members to add your masterpage code. See the Umbraco API documentation for full details (namespace umbraco.cms.businesslogic.template).

    HTH,

    Benjamin

  • Folkert 82 posts 212 karma points
    Sep 01, 2010 @ 09:27
    Folkert
    0

    Thanx, I didn't know I had to use the api.

  • Jamie Howarth 306 posts 773 karma points c-trib
    Sep 01, 2010 @ 10:59
    Jamie Howarth
    0

    Hey Folkert,

    No worries - it's cause the templates are also stored in the DB, creating them on the filesystem isn't enough - Umbraco doesn't implement a FileSystemWatcher on the ~/masterpages folder.

    Best,

    Benjamin

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies