Hijacking pages that use the same DocumentType and Template?
I have 3 pages. A home page with a home doc type and home template. A products page with a landing doc type and text page template and an about us page with a landing doc type and text page template. If I create a LandingPageController with an index, it hits the index method if I go to either Products or About Us. Is this something that is commonly done or if you find yourself needing to do this, is it better to just have a separate template for each doc type? I think you can inspect the name of the page when it hits the index action, but that seems like too much?
Yes, I understand that part, but what about the scenario where I have to pages that both use the LandingPage DocType and the LandingPage uses the TextPage Template. When it hits the LandingPageController and the TextPage action method, how will it know which actual page I am on (Products or About Us)?
I suppose from that pretext it does not really care. All of the routing will do is get you to the right controller / method.
The method gets a RenderModel (which is the page content), so if for some reason you have to know what page your serving up within the method you would need to do some checks.
Hijacking pages that use the same DocumentType and Template?
I have 3 pages. A home page with a home doc type and home template. A products page with a landing doc type and text page template and an about us page with a landing doc type and text page template. If I create a LandingPageController with an index, it hits the index method if I go to either Products or About Us. Is this something that is commonly done or if you find yourself needing to do this, is it better to just have a separate template for each doc type? I think you can inspect the name of the page when it hits the index action, but that seems like too much?
If I understood you correctly, I think you need to make sure the methods other than the Index method have the same name as the template your using.
Yes, I understand that part, but what about the scenario where I have to pages that both use the LandingPage DocType and the LandingPage uses the TextPage Template. When it hits the LandingPageController and the TextPage action method, how will it know which actual page I am on (Products or About Us)?
I suppose from that pretext it does not really care. All of the routing will do is get you to the right controller / method.
The method gets a RenderModel (which is the page content), so if for some reason you have to know what page your serving up within the method you would need to do some checks.
is working on a reply...