Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

How to find the No Of Layout Function in a Page

Vote:
 

Dear Team,

Can you please give me the syntax to find the no of layout functions in a page.

Regards

Phani Kumar R.V

#41503
Jul 08, 2010 17:41
Vote:
 

You can get all the functions on a Composer page and then iterate through them to find the number of layout functions.

There is a blog post the EDB/DropIt blog.
http://labs.dropit.se/blogs/post/2009/11/09/How-to-determine-if-an-EPiServer-Composer-function-is-placed-in-another-Composer-function.aspx

Not exactly what you want, but the approach can be useful. Good luck!

// Make sure that the current page is an Composer page
        if (this.CurrentExtensionPageData != null)
        {
            ContentFunctionData currentContentFunctionData = new ContentFunctionData(this.ContentFunctionLink);
           
            // Loop through all content areas in the page
            foreach(ContentAreaData ca in this.CurrentExtensionPageData.ContentAreas)
            {   
                // If any of the content areas contains the current content function it means that the function is placed directly on the page
                // - it's not placed in another content function
                if (ca.ContentFunctions.Contains(currentContentFunctionData))
                    return false;
            }
        }
       
        // If we reach this code it means that the content function is placed in another content function
        return true;

#43758
Sep 22, 2010 21:27
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.