1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Dynamic template based on domain

Dynamic template based on domain

4 posts, 0 answered
  1. Brian Crosby
    Brian Crosby avatar
    29 posts
    Registered:
    02 Jan 2006
    04 Mar 2010
    Link to this post
    Hello,

    I need to change the template for the home page based on the domain name. I have several sub domains pointing to my site and I would like to change the look and text of the home page for each domain. So I plan on creating a template for each domain and switching the home page template at runtime.

    How do I go about doing this? I found this thread which sounds similar: http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/issue-changing-template-on-the-fly.aspx

    but I don't want to update the database everytime a page is hit which is what it looks like that code does. That would obviously cause problems with multiple people hitting the site.

    Any ideas?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    04 Mar 2010
    Link to this post
    Hi Brian Crosby,

    You need to get the object in transaction as described in the post, because you cannot change some of its values. Changing the template will create a new version of a page depending on your domain. Basically you are performing editing of a page object programmatically instead of working through UI  where you change the template from DropDownList controls.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Brian Crosby
    Brian Crosby avatar
    29 posts
    Registered:
    02 Jan 2006
    04 Mar 2010
    Link to this post
    So is there no way to change a page's properties just for that page request context without updating the database?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    04 Mar 2010
    Link to this post
    Hi Brian Crosby,

    I think that the previous reply is clear and explains the cycle of working with ICmsPage object. The short answer to your question is no. Once you call SavePage you make a transaction. Sitefinity pages are not physical files. You can create a physical pages and change associated masterpages and themes without executing queries to the database through data provider.   

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
4 posts, 0 answered