Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Visibility based on site View modes: 
User avatar
Member
Member
Armysniper89 - 4/17/2011 9:12:22 AM
   
Visibility based on site
For my site, I have a development box, a staging server, and a production server. Content authors use the staging server for content production and I use the development box for testing out new web parts and to test new concepts.

On my root master page I have a Google Analytics web part set up with out account. My concern is that activity on my machine, and on my staging server will be posting "activity" to Google instead of just having it be the production server.

I thought of setting the Enabled property of the Web Part to only be when it is our production server but I cannot setup an OR in the macro. How can I accomplish this?

User avatar
Kentico Support
Kentico Support
kentico_radekm - 4/19/2011 2:11:13 AM
   
RE:Visibility based on site
Hello.

Could you please consider using custom macro in proper web part´s property (e.g. Visible property) and determine site´s code-name in code-behind? You can use logic similar to:

switch (CMS.CMSHelper.CMSContext.CurrentSiteName)
{
case "CorporateSite": return true; break;
case "EcommerceSite": return false; break;
default: return true; break;

}


You can find more details about how to write custom macro on http://devnet.kentico.com/docs/devguide/appendix_a___macro_expressions.htm

Best Regards,
Radek Macalik