WebMatrix makes it easy to create, customize, and publish your website. It’s an all-inclusive, simple web development tool from Microsoft that includes everything you need for website development. You can start with open source web applications, built-in web templates, or your own code. This talk will briefly introduce you to WebMatrix before diving into demos of how WebMatrix makes it easy for two potential users to create, customize, and publish a WordPress blog and a photo gallery site. You will learn how to use Razor syntax, set up membership, leverage useful helpers, and other tips and tricks to get these two different types of sites (one from the Web Gallery, one from a template) up and running. Get a head start by downloading WebMatrix here: http://bit.ly/MSwebmatrix
Build a WordPress Blog and Photo Gallery Site in 60 Minutes!
1. Build a WordPress Blog and Photo Gallery Site in 60 Minutes! With WebMatrix Alice Pang Developer Evangelist, Microsoft http://blogs.msdn.com/alicerp http://twitter.com/alicerp
3. WebMatrix Users Peter Eric I want to build a web site for my photos with an easy to learn tool and framework I need a blog, so I need a tool that makes it easier to configure, customize and publish it.
8. Eric’s to-do’s set up a photo gallery site customize with Razor syntax Set up admin Add Facebook helper Publish the photo gallery site
9. Razor Syntax is Easy! Web Forms (6 markup transitions): <ul> <% for (int i = 0; i < 10; i++) { %> <li><% =i %></li> <% } %> </ul> <ul> <?php for ($i = 0; $i < 10; $i++) { echo("<li>$i</li>"); } ?> </ul> PHP(2 markup transitions & an echo): <ul> @for (int i = 0; i < 10; i++) { <li>@i</li> } </ul> Razor (2 markup transitions):
10. Commenting in Razor @* <div> Hello World </div> *@ Option 1: Markup @{ //var name = "John Doe”; //@name } Option 2: Code @* @{ var name = "John Doe"; //@name } *@ Option 3: Both
11. Layouts make organizing your pages easier Don’t repeat yourself! Define one layout and use it across your website Page 1 Layout.cshtml Page 2 Page 3
13. Use Sections to organize your pages Sections allow you to define areas of content that change between pages but need to be included in a layout /Shared/_Layout.cshtml MyPage.cshtml <html> <head> <title>Simple Layout</title> </head> <body> @RenderSection("Menu") @RenderBody() </body> </html> @{ Layout = "/Shared/_Layout.cshtml"; } @section Menu { <ulid="pageMenu"> <li>Option 1</li> <li>Option 2</li> </ul> } <p> My content goes here </p>
15. What is Membership? Provides registration for users Organize users into roles Restrict access to pages on your website based on user or role Some templates include Admin folder with all the pages required for membership
16. Setting up Membership Set up membership in one line of code /_AppStart.cshtml @{ WebSecurity.InitializeDatabaseConnection("StarterSite", "UserProfile", "UserId", "Email", true); } StarterSite database
18. What are Helpers? Helpers make it easy to quickly add commonly used functionality into your websites Helpers are designed to make your life easier Some examples: Facebook Twitter PayPal UserVoice OData Windows Azure Storage And many more…
19. Two categories of Helpers You can think of Helpers like this: HTML Helpers Make is faster and easier to render commonly used markup to the page. Examples: Facebook, Twitter API Helpers Make is faster and easier to call complex APIs from your website. Examples: PayPal, OData, Windows Azure Storage
20. Make your website social Add social capabilities to your website with the WebMatrix Helper for Facebook There are many more helpers available for WebMatrix @FacebookSocialPlugins.Comments()