Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Changing widget content by user's location View modes: 
User avatar
Member
Member
timothy.mierzejewski-theprimacy - 10/30/2013 8:27:08 AM
   
Changing widget content by user's location
Hello all,

We have some instances on our site where we want to show different content to the user based on where they're visiting the site from. For instance, a user from the state of Michigan would see one block of rich text, while a user from the state of Wisconsin would see a different block of rich text.

A few questions:

1. Is there any built-in location detection (by IP) that is built in with Kentico?

2. We keep our rich text content in widgets. Is there a good way to either swap out the text content of a Rich Text widget based on a condition (perhaps using a macro), or to make certain widgets visible based on a condition? I see that web parts and web part zones can use visibility macros, but widgets, oddly, don't appear to have that functionality.

3. If resource strings (like those in the UI cultures table) contain HTML markup, will that HTML be rendered if referenced in a user control? We were considering using different cultures as a possible solution to this, but we weren't sure if it's a valid way to go.

Thanks in advance for any guidance you have on these questions.

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 11/4/2013 11:17:35 AM
   
RE:Changing widget content by user's location
Hello Timothy,

1. Yes, of course there is a built-in geolocation in the Kentico. For this purpose I would recommend you to take a look at the API Reference, especially CMS.WebAnalytics ► GeoIPHelper, e.g. GetCountryByIp(String) method.

2. You can simply enable the visibility property for any widget:
1. Navigate to the Site Manager / Development / Web parts section and choose the web part your widget is based on.

2. Switch to Properties tab.

3.. Create new property with the following parameters:
 Column name: Visible
Attribute type: Boolean (Yes/No)
Field caption: Visible
Form control: Check box
Save it.

4. Enable "Display attribute in the editing form" setting.

5. Navigate to the Site Manager / Development / Widgets section and find given widget.

6. Switch to Properties tab, choose "Visible" property and enable "Display attribute in the editing form" setting.

3. I'm not sure if I understand your question, so could you please be more specific or provide me with an example?

Best regards,
Martin Danko