Sign In  |  Register
 
 DotNetNuke Powered!
DotNetNuke Support Forums

Conditional code for home page

Rate this topic:

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

AuthorMessages
jncraig
Posts:83



05/23/2007 10:28 PM  
The thread in the Tricks & Tips forum about putting conditional code in the skin got me thinking.

Is there a way to determine if "this page" is the home page and do some conditional coding?
John Mitchell
Posts:3478



05/23/2007 10:33 PM  
If you know the name of the home page you could do it like this:
<%If PortalSettings.ActiveTab.TabName = "Home"  Then%>

Conditional Content for home page

<% End If %>
jncraig
Posts:83



05/24/2007 10:12 AM  
Thanks, yet again!
jncraig
Posts:83



05/24/2007 10:19 AM  
can these embedded code blocks be nested?

<% IF some condition Then %>

<% If some other condition Then %>

code

<% End If %>

<% End If %>
John Mitchell
Posts:3478



05/24/2007 10:33 AM  

Watch out, you may be on the road to becomming a programmer!

The code itself can be nested.  The delimiter <%  is only needed when switching to the code or back to content %>

So the answer is yes, but it is not real efficient to switch in and out of code so your example would look more like this:

<%  If firstCondition Then %>

 Content for first condition

     <%  If secondCondition Then %>

       Content that requires firstCondition AND secondCondition to be true

<%      End If  ' to end secondcondition
      End If  ' to end first condition   %>
Or, if you only want content that meets both conditions you would use a logical AND
<%  If firstCondition AND secondCondition Then %>


       Content that requires firstCondition AND secondCondition to be true

<% End If %>
jncraig
Posts:83



05/24/2007 10:40 PM  
>Watch out, you may be on the road to becomming a programmer!

  It's WAAAAY to late for that. I'm an old guy who grew up on Fortran, but I'm learning this new-fangled style of software development. I'd made a quick venture in the mid 90s, and got back to this about a year ago. ... and there's a lot to learn ...
Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

Forums >DotNetNuke Support >General-DNN-Help > Conditional code for home page



ActiveForums 3.7
Visit our Store for great DotNetNuke Modules and Skins
DNNMasters Sitemap/Google Sitemap 3.0

Item codeSM3-01
Price$29.00
Product Information 
DotNetNuke CSS NavMenu 3.3 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
Snapsis PageBlaster 3.3.2 Performance for DotNetNuke - Professional Edition

AuthorJohn Mitchell
Base Price$79.00
Product Information 
XDAkuna (Web 2.0 CSS XHTML Skin)

Item codeXDAkuna
AuthorNina Meiers
Price$49.00
Product Information 
XDAkuna (Web 2.0 CSS XHTML Skin)

AuthorNina Meiers
Price$49.00
Product Information