Copied to clipboard

Flag this post as spam?

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


  • Saied 349 posts 674 karma points
    Jul 10, 2015 @ 18:03
    Saied
    0

    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?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jul 10, 2015 @ 18:11
    Rusty Swayne
    0

    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.

  • Saied 349 posts 674 karma points
    Jul 10, 2015 @ 18:13
    Saied
    0

    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)?

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jul 10, 2015 @ 18:35
    Rusty Swayne
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft