You need to sign in to do that
Don't have an account?

Custom controller - how to return a record based on current page name
Hi
I want to return a custom object record based on a query using the name of the VF page. I can do it using an id with :ApexPages.currentPage().getParameters().get('id') ... but that's not what I want.
Please can someone fill in the ?????s below for me?
public with sharing class PageRenderer {
public Page_Layout__c[] getPageLayout() {
return [select Name,
nav_level_1__c,
nav_level_2__c,
page_title__c
from Page_Layout__c
where name = ??????];
}
}
return [select Name,
nav_level_1__c,
nav_level_2__c,
page_title__c
from Page_Layout__c
where name = :Page.PAGENAME];
where pagename is the name of ur vf page ?
Thanks - but I want it to give the controller the name of the current VF page, so that I can use the controller across all pages. Otherwise I'd have to hard code the name in to each page's controller.
Where is all the Page. Site. variable stuff documented? A couple of hours googling has failed to find anything useful.
I could pass it as a variable from the VF page to the controller (using $CurrentPage.Name) but I haven't figured out how to do that either.