function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ToddA.ax1079ToddA.ax1079 

Retrieving Page name

I'm trying to render the name of a VisualForce page as a CSS style so that i can have a dynamic header image on VF pages on my site. Is there some way to do this using the PageReference class? I've tried the following but it doesn't look like the class has any sort of property or method for the name:

 

public static String getPageName(){

        PageReference ref = ApexPages.currentPage();

        return ref.getName();

}

 

I've also tried the global variable $CurrentPage.Name in the VF page but i need to be able to perform a string operation on the page name, and $CurrentPage.Name.split('_', 2) generates an error.