Friday, July 27, 2012

How to rename the /Umbraco directory?

When you want to rename the /Umbraco directory are two possibilities.

  1. You rename folder to 'admin', or whatever you want; change in web.config some lines - where is umbraco -> admin. Choosing this solution might not be that nice. When you will install a new package that will try to install on /Umbraco folder, so you will have to move files. Beside you still have to make some updates in Css files as it is hard-coded the paths.
  2. The second solution it is a very simple one :) Go to yoursite/Umbraco/UrlRewriting.config and add this  line in <rewrites> 




Good luck, ;)

Monday, July 23, 2012

How to create a sitemap/navigation for website in Umbraco with XSLT?

Working on a project, made in Umbraco CMS, I got to the point where I had to generate a navigation in footer. Just something like this






This is content Tree. Not all pages from footer image above appear in sitemap structure. I put the image just for you to realize what I had to do and what you might also want to achieve.

Now: according to my content, I wanted a list like this:

  •  About Patient Direct with childs bellow
  1.  Program Coverage (this page as you can see in image above has Hide in navigation = yes, so for me means they are childs of About....) 
  2.  Eligibility 
  •  Network 
  1.  About the Patient...
  2.  Dentist Search 
  •  Enroll Now 
  •  Wellness
Pretty nice, hm?
Good so how do you generate such a menu using Xslt?
Here is code I did and helped me.

< ? xml version="1.0" encoding="UTF-8" ? >
< ! DOCTYPE 
xsl:stylesheet [
    < ! ENTITY nbsp " ">
] >



    
    
    
    
    
        
            
        
    

    
        
        
        

            
                

        

    

    
        
        
  • bottom_border
  • bottom_border
If you need explanations about code please write it as a comment ;)

Monday, July 16, 2012

How to delete all tables from a Database?

If you want to delete all tables from a database you can help yourself by using this query:

DECLARE @TableName varchar(500)
DECLARE cur CURSOR
      FOR SELECT [name] FROM sys.tables WHERE type in ('u') 

      OPEN cur

      FETCH NEXT FROM cur INTO @TableName
      WHILE @@fetch_status = 0
      BEGIN
            EXEC('DROP TABLE ' + @TableName)
            --select @TableName
            FETCH NEXT FROM cur INTO @TableName
      END
      CLOSE cur
      DEALLOCATE cur 

     
In case you have constraints take special care you delete tables one by one ;)