Created
October 27, 2017 09:58
-
-
Save ps-team/ef9d9064ee95126b070aba5c628c4f97 to your computer and use it in GitHub Desktop.
Hiding placeholders - simple stuff, but there are bits here that can be quite useful
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hide a placeholder if it is empty | |
If Control.controls.count = 0 then | |
If value.trim.toLower.indexof("[add content here]") > -1 Or StripHTML(HttpUtility.HTMLDecode(value).trim).length = 0 then | |
Control.visible = false | |
End If | |
End If | |
// Hide a placeholder if it is empty, also adding in a check for images. | |
If Control.controls.count = 0 then | |
If value.indexof("<img") = -1 then | |
If StripHTML(HttpUtility.HTMLDecode(value).trim).length = 0 then | |
Control.visible = false | |
Else | |
If value.trim.toLower.indexof("[add article image here]") > -1 then | |
Control.visible = false | |
End If | |
End If | |
End If | |
End If | |
// Hide another div, if a placeholder is empty | |
If Control.controls.count = 0 then | |
If value.trim.toLower.indexof("[add content here]") > -1 Or StripHTML(HttpUtility.HTMLDecode(value).trim).length = 0 then | |
Div_Id.visible = false | |
End If | |
End If | |
// Add attributes to another div / element based on a placeholder being hidden (e.g. switching a class) | |
If Control.controls.count = 0 then | |
If value.trim.toLower.indexof("[add content here]") > -1 Or StripHTML(HttpUtility.HTMLDecode(value).trim).length = 0 then | |
Control.visible = false | |
Div_Id.attributes("class")= mainColumn.attributes("class") & " sys_fullWidth" | |
End If | |
End If | |
// Other attribute examples; | |
Div_Id.attributes("class")= "sys_stickyFace" | |
Div_Id.attributes("style")= "position:naughty;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment