I am looking for a quick and dirty way to query the layouts files of a particular page by its friendly url. This is probably easy, but I can’t find the solution.
Basically I want to say something like the following. Pseudo-code:
var mainpage = Sitecore.EasyQueryUtility.GetItemByFriendlyUrl(requestedUrl);
or
var mainpage = Sitecore.EasyQueryUtility.GetOppositeOfFriendlyUrl(friendlyurl);
It sounds like you want to do two things here:
If those are correct, hopefully this can help you out:
Note: untested code I did on-the-fly
Once you have the item you can get the layout’s name like so:
Or the layout’s physical file path to the ASPX: