Design and CSS styles
Version 6.x > Design and CSS styles > Make an entire page invisible View modes: 
User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/4/2013 10:41:04 PM
   
Make an entire page invisible
Hello,

I have a page that I need to make invisible until a certain time, then I'll make the page visible.

Is there a way to make an entire page invisible until I toggle it back to visible? I know how to do this with certain web-parts, but I don't know how to do this with a whole page.

I've tried editing the page's properties but I don't see a way to hide the entire page.

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/6/2013 1:11:52 AM
   
RE:Make an entire page invisible
Anybody have any suggestions, or am I out of luck?

User avatar
Member
Member
support-kentico - 11/6/2013 1:20:00 AM
   
RE:Make an entire page invisible
Hi,

Thank you for your message.

What exactly do you mean by "hide"? What I was thinking is that if you click on the page within the content tree and then switch to Form tab you can set the Publish from field which means that the page will not be active until this date. Would this work for you?

Let me know for further assistance.

Kind regards,
Richard Sustek

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/6/2013 2:17:45 AM
   
RE:Make an entire page invisible
Hi Richard,

Thank you for the reply.

I just tried that. I still see the page on my staging server when I chose "preview". If I sync this setting with my production server, does that mean the page on the production server won't be visible until the time I set?

Sorry to ask such basic questions, I'm new to Kentico.

Thank you.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/6/2013 3:35:39 AM
   
RE:Make an entire page invisible
Hi,

No problem at all.

Regarding your issue I believe that this is cause because you are logged as Global administrator and you have access to everything, everywhere and you are able to see unpublished pages as well. Can you try that in different web browser or after logging out?

How does it work?

Let us know for further assistance.

Kind regards,
Richard Sustek

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/6/2013 7:40:07 PM
   
RE:Make an entire page invisible
Richard, that was it. You're an ace. Thank you!


User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/6/2013 7:42:23 PM
   
RE:Make an entire page invisible
@Richard - Do you know anything about user-agent redirects?

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/7/2013 2:13:04 AM
   
RE:Make an entire page invisible
Hi,

I'm glad it work, thank you:)

May I ask what particular issue you have in mind? If you want to redirect users based on their user agent (mobile devices..) you can make use of our built-in webpart called Mobile redirection
If you have our sample Corporate site installed you can see this webpart in action on Home page where it basically redirects the given devices (configured in the webpart properties) to the given subsection used for mobiles.

This link could also point you to the correct direction http://devnet.kentico.com/docs/devguide/index.html?mobile_development.htm

Let me know if you have any further questions.

Kind regards,
Richard Sustek

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/7/2013 2:21:39 AM
   
RE:Make an entire page invisible
Thanks for getting back to me.

I tried using Mobile redirection. It works when on an Android or iPhone because there are pre-set choices for those.

But when I try to do it by user-agent for Japanese cell phones (such as "DoCoMo"), the devices do NOT redirect. There is a section called "User-agent (small devices)" and you can enter user-agents one by one.

I've tried
DoCoMo
Docomo
docomo
DOCOMO

but when I try it on a DoCoMo phone, it doesn't redirect. I have checked the logs of the server and this exact DoCoMo does appear in the logs so I know the user-agent starts with "DoCoMo". I don't know what I'm doing wrong.

I'm using Kentico 6.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 11/7/2013 3:52:59 AM
   
RE:Make an entire page invisible
Hi,

We are using the http://51degrees.mobi/ service for detecting mobile devices, it claims to be 99.9% accurate, but it may happen that some of the devices (especially some chinese/japanese ) are not yet supported.

However you could try to bypass this in code behind (e.g. you may customize our redirection webpart).

You could use something like this:
CMSContext.CurrentDevice.DeviceName.Contains("phone name");

The CMSContext.CurrentDevice holds several variables such as IsMobile, MaxSreenSize, DeviceName... some of these might be of a help to you identifing the mobile device.

You can then redirect url easily with using the :
URLHelper.Redirect("http://www.google.com");

Kind regards,
Richard Sustek

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/7/2013 8:08:44 PM
   
RE:Make an entire page invisible
Richard,

Thank you so much for that. It seems like it would be very helpful.

Where do I add those lines - would it be in the CSS of the main page?
For example: cmsdesk ->Content -> Edit -> Design -> Page Layout


User avatar
Certified Developer 13
Certified Developer 13
kentico-jx2tech - 11/7/2013 9:30:19 PM
   
RE:Make an entire page invisible
Try adding a Random redirection web part to the document and set the following properties:

Visibility: {%BrowserInfo.UserAgent.ToLower().Contains("docomo")%}
Redirection URLs: /the/path/to/your/mobile/site

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/8/2013 3:47:39 AM
   
RE:Make an entire page invisible
I added the web part, but where do I add the code?

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/8/2013 3:58:33 AM
   
RE:Make an entire page invisible
For example, I added the web-part "Random redirection".

Under "Visibility", I have 4 choices;

Visible
Hide on subpages
Show for document types:
Display to roles:

Where can I paste that code?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 11/8/2013 4:04:06 AM
   
RE:Make an entire page invisible
Hello Chris,

Near the visibility label, you can see a small black arrow, so please click on this arrow and you will be able to add the code in the special dialog window.

Best regards,
Martin Danko

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/10/2013 6:09:52 PM
   
RE:Make an entire page invisible
Martin,

Thank you so much.

So this is what I did;

In Visibility, I hit the black arrow and pasted the code from above into the window:

Visibility: {%BrowserInfo.UserAgent.ToLower().Contains("docomo")%}
Redirection URLs: http://<our mobile site's URL>

I saved it and it shows up now under "Visibility".
But when I tried it on a DoCoMo phone, it still didn't redirect to the mobile site.

Did I do something wrong?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 11/15/2013 3:25:47 AM
   
RE:Make an entire page invisible
Hello Chris,

If you will simply put into visibility property macro like:
{%BrowserInfo.UserAgent%}

What does it return in your case? Not all devices are recognized and supported in the free version of mobile detection as we are using the 3rd party software to detect that.

Best regards,
Martin Danko

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/15/2013 4:14:52 AM
   
RE:Make an entire page invisible
Dude, you are a lifesaver! I got it to work!!

Is there a way to do it for more than one string? Such as
{%BrowserInfo.UserAgent.ToLower().Contains("docomo|KDDI|au|Softbank")%}

Thanks for all of your help!!

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 11/15/2013 4:25:54 AM
   
RE:Make an entire page invisible
Hi Chris,

I'm glad that you have moved one step forward. I'm not sure how will it work in this case but you can simply use e.g. OR directive (or IF-ELSE) to combine more macro expressions.
Take a look here: K# syntax.

Best regards,
Martin Danko

User avatar
Certified Developer 13
Certified Developer 13
kentico-jx2tech - 11/15/2013 6:58:25 AM
   
RE:Make an entire page invisible
here is a way to loop through a pipe delimited list...
{% 
Keywords = "docomo|KDDI|au|Softbank";
KeywordsArray = keywords.ToLower().Split("|");

UA = CurrentDevice.UserAgent.ToLower();

foreach (Keyword in KeywordsArray) {
if (UA.Contains(Keyword)) {
return true;
}
}

return false;
%}

User avatar
Certified Developer 13
Certified Developer 13
kentico-jx2tech - 11/15/2013 7:02:42 AM
   
RE:Make an entire page invisible
if CurrentDevice is unavailable in v6 use BrowserInfo.

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/17/2013 6:25:16 PM
   
RE:Make an entire page invisible
jx2tech, thank you for this. I will try this today. You guys are great.

So the language isn't C# but K#, correct?

User avatar
Certified Developer 13
Certified Developer 13
kentico-jx2tech - 11/17/2013 7:07:46 PM
   
RE:Make an entire page invisible
That is correct... the Kentico# flavor :)

User avatar
Member
Member
chris.worthington-barclayvouchers.co - 11/27/2013 3:35:30 AM
   
RE:Make an entire page invisible
Sorry for not replying in a while.

The code above didn't work - I changed "CurrentDevice" as was suggested, but it forwarded ALL users, not just those matching that in the user agent string.

Is there something I might have done wrong?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 11/28/2013 4:13:50 AM
   
RE:Make an entire page invisible
Hello Chris,

I would simply recommend you to upgrade to version 7 where a whole development model is more focused also on a mobile development and its features.

Best regards,
Martin Danko