LogoLogo
  • FAC Curriculum
  • archive
    • Node & npm introduction
    • developer
      • Programming Paradigms
    • handbook
      • Asking for help
      • Coaching groups
      • Code review
      • Course rules
      • Debugging
      • Employment schedule and material delivered in FAC20
      • GitHub Workflow
      • Glossary or terms
      • Presentation Guidance
      • Equality, Diversity and Inclusion
      • Installation guide
      • Learning circles
      • Mentoring guidance
      • What to expect from your mentors
      • One-day projects
      • Pair programming
      • Portfolio
      • Questions for problem solving
      • Progress Logs
      • Final project report
      • Managing software projects
      • Project Presentations
      • Project roles
      • Projects
      • Retrospectives
      • Role Circles
      • Safeguarding policy
      • Technical Spikes
      • System requirements
      • Tech for Better
      • User Manuals
      • Wellbeing Support
      • project-docs
        • What makes a mentor?
        • Product Handover
        • Sprint Planning
        • Tech for Better Presentations
        • User Research & Usability Testing
    • foundation
      • full-stack
        • Learning Outcomes
        • project
      • testing
        • project
        • spikes
  • docs
    • Contributing to the curriculum
    • Curriculum intent
    • Curriculum process
  • src
    • About our curriculum
    • course
      • Code of Conduct
      • Docker
      • .NET and Umbraco
      • Getting started
      • Founders and Coders coursebook
      • KSB's
      • Mini projects
      • Revision checklist
      • Svelte
      • TypeScript
      • handbook
        • Software Developer Handbook
        • Software Foundation Handbook
      • precourse
        • Before you start the course
        • Installation List
      • syllabus
        • developer
          • app
            • learning-outcomes
            • project
            • schedule
            • spikes
          • introduction
            • learning-outcomes
            • project
            • resources
            • schedule
          • week00-pre-course
            • We'd like you to spend some time before starting the course working on useful fundamentals.
            • spikes
          • week01-project01-basics
            • Employability introduction
            • Homework
            • learning-outcomes
            • Week of September 9th
            • project
            • resources
            • schedule
            • spikes
          • week02-project02-chatbot
            • employability
            • Homework
            • learning-outcomes
            • Week of September 16th
            • project
            • resources
            • schedule
            • spikes
          • week03-project03-server
            • Learning Outcomes
            • Week of September 23th
            • The Amazin' Quizzer API Backend
            • resources
            • schedule
          • week04-project03-frontend
            • learning-outcomes
            • Week of September 30th
            • UI for Quizzer App
            • resources
            • schedule
          • week05-project03-test-deploy
            • Testing and deployment
            • Week of October 7th
            • project
            • resources
            • schedule
          • week06-project04-databases
            • learning-outcomes
            • Week of October 14th
            • project
            • Databases
            • schedule
          • week07-project04-authentication
            • Learning Outcomes
            • Week of October 21st
            • project
            • resources
            • schedule
          • week08-project04-test-deploy
            • Learning Outcomes
            • Week of October 28th
            • project
            • resources
            • schedule
          • week09-reading-week
            • Learning Outcomes
            • overview
            • Project
            • Resources
            • schedule
          • week10-project05-DOTNET-intro
            • Learning Outcomes
            • overview
            • project
            • Resources
            • schedule
          • week11-project05-DOTNET-testing
            • Testing and deployment
            • Week of November 18th
            • project
            • Resources
            • schedule
          • week12-project05-DOTNET-deploy
            • Learning Outcomes
            • Week of November 25th
            • project
            • Resources
            • schedule
            • Spikes
          • week13-TFB-design
            • Learning Outcomes
            • overview
            • Project
            • Resources
            • schedule
            • Design Week Spikes
          • week14-TFB-build
            • Learning Outcomes
            • overview
            • Project
            • DevOps Resources
            • schedule
            • Spikes
          • week15-TFB-build
            • Learning Outcomes
            • overview
            • Project
            • Resources
            • schedule
            • Spikes
          • projects
            • in-house-design
              • Learning Outcomes
              • Project
              • Resources
              • schedule
              • Design Week Spikes
        • foundation
          • Obsolete-full-stack
            • project
          • post-course
            • Homework
            • schedule
        • portfolio
          • fruit-shop
            • learning-outcomes
            • project
            • resources
          • game
            • learning-outcomes
            • project
            • resources
          • hobby-page
            • learning-outcomes
            • project
            • resources
          • movie-data
            • learning-outcomes
            • project
            • resources
          • project-gallery
            • learning-outcomes
            • project
            • resources
          • website
            • learning-outcomes
            • project
            • JavaScript
        • tfb
          • week 1
            • Introduction (45 minutes)
            • Further reading
          • week 10
            • content
            • resources
          • week 11
            • What will we be doing this week?
            • resources
          • week 12
            • What will we be doing this week?
            • Further reading
          • week 2
            • Discover (90 minutes)
            • resources
          • week 3
            • content
            • resources
          • week 4
            • Mapping the user journey (90 minutes)
            • resources
          • week 5
            • Figma Workshop 1 (90 minutes)
            • Further reading
          • week 6
            • Figma Workshop 2 (90 minutes)
            • resources
          • week 7
            • Product pitches & Selection (90 minutes)
            • resources
          • week 8
            • content
            • resources
          • week 9
            • content
            • resources
    • learn
      • DOTNET
        • Introduction to .NET
      • auth
        • Authenticating web apps
      • database
        • Persisting data with SQLite and Node
      • dotnet-two
        • Dependency injections and interfaces in .NET
      • form-validation
        • Form validation
      • react
        • Building client-side apps with React
      • server
        • HTTP servers with Node & Express
      • typescript
        • TypeScript
    • mentoring
      • design-week
        • Analysis Workshop
        • Code planning
        • Definition Workshop
        • Discovery Workshop
        • Figma introduction
        • Usability testing
        • User Research
    • resources
      • http
        • introduction
    • workshops
      • cookie-auth
        • index
      • creating-promises
        • index
      • css-layout
        • index
      • cypress-testing
        • index
      • database-testing
        • index
      • dev-tooling
        • Developer tooling
      • dom-challenge
        • index
      • dom-rendering
        • index
      • es-modules
        • index
      • express-middleware
        • Express middleware
      • first-class-functions
        • index
      • form-validation
        • index
      • functions-callbacks-async
        • Functions, callbacks, & async JavaScript
      • git-intro
        • Introduction to Git
      • git-terminal
        • Using Git in the terminal
      • git-workflow
        • Git workflow
      • github-projects
        • GitHub Projects Workflow Workshop
      • heroku-sql-challenge
        • index
      • html-forms
        • index
      • learn-a11y
        • index
        • starter-files
          • solution
            • Accessibility solution explanation
      • learn-fetch
        • index
      • learn-integration-testing
        • index
      • learn-testing
        • Learn testing in JavaScript
      • learn-unit-testing
        • index
      • node-error-handling
        • Node error-handling
      • node-express-server
        • Node and Express HTTP server
      • node-npm-intro
        • Node & npm introduction
      • node-postgres
        • Learn Postgres with Node
      • node-scripting-challenge
        • index
      • password-security
        • index
      • promise-practice
        • index
      • react-components
        • React components
      • react-fetch
        • index
      • react-forms
        • React forms
      • react-refactor-classes
        • index
      • react-state-effects
        • React state & effects
      • real-world-fetch
        • index
      • scope-challenge
        • Scope debugging challenge
      • semantic-html
        • index
      • server-side-forms
        • Server-side forms
      • session-auth
        • Session authentication
      • sql-intro
        • index
      • tdd-array-methods
        • index
Powered by GitBook
On this page
  • .NET
  • Intro
  • Project
  • Spike
  • Repository naming convention
  • Acceptance criteria
  • PHP
Export as PDF
  1. src
  2. course
  3. syllabus
  4. developer
  5. week10-project05-DOTNET-intro

project

PreviousoverviewNextResources

Last updated 6 months ago

.NET

Intro

Learners with build a library in which to sort and share information (i.e. music, photos, recipes etc...). Potential users should be able to view, favourite and upload items as well as make collections and view ones created by other users.

The frontend of this project will be built using React. For the backend, it will use ASP.NET to handle server-side functionality. User accounts and item lists will be stored in a PostgreSQL or SQLite database.

Project

Your project for the next 3 weeks will be to develop a .NET backend connected to a database and linked to a React frontend. This week you should start by building the backend and testing it with Swagger (.NET equivalent to Postman). Tests should cover the creation users and endpoints related to user content.

Spike

Like the last project you will benefit by building a scheme for your database before you start. Hopefully with what you learned from last projects you are ready to think about how things will connect and consider what sorts of endpoints you will want. Finally, think about what you have done for stretch goals on previous projects and see if you can come up with a different sort of goal this time. For example if you've been stretching yourself by adding technical complexity try focusing on design or UX/UI instead.

Questions to consider

  1. What endpoints will you need for your app?

  2. What sort of classes will you need to match your data and how will these be represented in OOP (object orientated programming)?

Useful resources

User stories

As a user, I want to:

  • Login to an individual account

  • See my collections of items and favourites

  • Search and look at other users collections

  • View individual items details

  • Save items or collections from other users

  • Upload and add items

Stretch user stories

  • Follow other users

  • Make sure users can only edit their own collections and items

  • Stop duplicate items being uploaded

  • Suggest collections based on favourites

Repository naming convention

Please name your repo following this template: PRO05_Name1_Name2_Name3_Name4

Acceptance criteria

Stretch


PHP

Project Overview: Building a Custom WordPress Site with Theme and Plugin Development

Over the next three weeks, you will develop a fully functional WordPress website from scratch. Starting with setting up your local development environment, you'll create a custom theme tailored to your design preferences, incorporating dynamic content using The Loop and interactive elements with TypeScript. You'll then plan and build a custom plugin to add significant functionality to your site, such as an event manager or testimonials feature, utilizing custom post types, taxonomies, and AJAX for dynamic updates.

In the final week, you'll focus on deploying your site to a live hosting environment, implementing security best practices, and optimizing performance. By integrating your custom plugin with your theme, you'll create a seamless user experience. This project will enhance your proficiency in WordPress development and PHP programming, providing you with valuable skills and a portfolio-worthy website.

Foundations of WordPress and PHP

Monday: Setting Up the Development Environment

  • Objectives:

    • Set up a local server environment for WordPress development.

    • Install and configure WordPress locally.

    • Understand the WordPress file and folder structure.

  • Activities:

    1. Install a Local Server Environment:

      • Choose and Install Software:

      • Configure the Server:

        • Start Apache and MySQL services from the control panel.

    2. Download and Install WordPress Locally:

      • Download WordPress:

      • Set Up the Database:

        • Access phpMyAdmin via http://localhost/phpmyadmin/.

        • Create a new database (e.g., wordpress_db).

      • Configure WordPress:

        • Extract WordPress files into the htdocs (XAMPP) or MAMP directory.

        • Rename wp-config-sample.php to wp-config.php.

        • Edit wp-config.php with the database details:

          define('DB_NAME', 'wordpress_db');
          define('DB_USER', 'root');
          define('DB_PASSWORD', '');
      • Run the Installation Script:

        • Navigate to http://localhost/wordpress/ and follow the installation prompts.

    3. Explore WordPress File Structure:

      • Directories to Explore:

        • wp-content: Holds themes, plugins, and uploads.

        • wp-includes: Core WordPress files.

        • wp-admin: Backend administration files.

      • Understanding Core Files:

        • Review index.php, wp-config.php, and .htaccess.

    4. Review PHP Basics (If Needed):

      • PHP Syntax and Structure:

        • Variables, arrays, loops, functions.

      • Resources:

  • Resources:


Tuesday: Introduction to WordPress Theme Development

  • Objectives:

    • Understand how WordPress themes work.

    • Begin developing a custom theme from scratch.

  • Activities:

    1. Study the WordPress Template Hierarchy:

      • Understand the Hierarchy:

        • Learn how WordPress determines which template file to use.

    2. Create a New Theme Directory:

      • Set Up Theme Folder:

        • Navigate to wp-content/themes/.

        • Create a new folder for your theme (e.g., my-custom-theme).

    3. Develop Basic Theme Files:

      • style.css:

        • Add theme information at the top:

          /*
          Theme Name: My Custom Theme
          Theme URI: http://example.com/
          Author: Your Name
          Description: A custom theme for learning.
          Version: 1.0
          */
      • index.php:

        • Basic template file that WordPress uses by default.

        • Add a simple HTML structure:

          <!DOCTYPE html>
          <html>
          <head>
            <title><?php bloginfo('name'); ?></title>
            <?php wp_head(); ?>
          </head>
          <body>
            <h1>Welcome to <?php bloginfo('name'); ?></h1>
            <?php wp_footer(); ?>
          </body>
          </html>
      • header.php and footer.php:

        • Separate the header and footer sections.

        • header.php:

          <!DOCTYPE html>
          <html>
          <head>
            <title><?php bloginfo('name'); ?></title>
            <?php wp_head(); ?>
          </head>
          <body>
        • footer.php:

            <?php wp_footer(); ?>
          </body>
          </html>
        • Include them in index.php using get_header() and get_footer() functions:

          <?php get_header(); ?>
          <h1>Welcome to <?php bloginfo('name'); ?></h1>
          <?php get_footer(); ?>
    4. Activate the Theme:

      • Through WordPress Admin:

        • Go to Appearance > Themes.

        • Find and activate "My Custom Theme".

    5. Use Template Tags and The Loop:

      • Display Posts:

        • Implement The Loop in index.php:

          <?php get_header(); ?>
          <?php
          if ( have_posts() ) :
            while ( have_posts() ) : the_post();
              the_title('<h2>', '</h2>');
              the_content();
            endwhile;
          else :
            echo '<p>No posts found.</p>';
          endif;
          ?>
          <?php get_footer(); ?>
  • Resources:


Wednesday: Advanced Theme Customization

  • Objectives:

    • Add features to the custom theme.

    • Integrate TypeScript for front-end interactivity.

  • Activities:

    1. Create Custom Page Templates:

      • Make a Custom Template:

        • Create page-custom.php in your theme folder.

        • At the top, add:

          <?php
          /*
          Template Name: Custom Page
          */
          ?>
        • Modify the template as needed, for example:

          <?php get_header(); ?>
          <div class="custom-page-content">
            <h2>Custom Page Template</h2>
            <?php
            if ( have_posts() ) :
              while ( have_posts() ) : the_post();
                the_content();
              endwhile;
            endif;
            ?>
          </div>
          <?php get_footer(); ?>
    2. Implement Custom Menus:

      • Register Menus in functions.php:

        <?php
        function register_my_menus() {
          register_nav_menus(
            array(
              'header-menu' => __( 'Header Menu' ),
              'footer-menu' => __( 'Footer Menu' )
            )
          );
        }
        add_action( 'init', 'register_my_menus' );
      • Display Menus in Templates:

        <?php
        wp_nav_menu( array( 'theme_location' => 'header-menu' ) );
        ?>
    3. Add Widget Areas (Sidebars):

      • Register Sidebar in functions.php:

        function my_custom_sidebar() {
          register_sidebar(
            array (
              'name' => __( 'Custom Sidebar', 'your-theme-domain' ),
              'id' => 'custom-sidebar',
              'description' => __( 'Custom Sidebar for Theme', 'your-theme-domain' ),
              'before_widget' => '<div class="widget-content">',
              'after_widget' => '</div>',
              'before_title' => '<h3 class="widget-title">',
              'after_title' => '</h3>',
            )
          );
        }
        add_action( 'widgets_init', 'my_custom_sidebar' );
      • Display Sidebar in Templates:

        <?php
        if ( is_active_sidebar( 'custom-sidebar' ) ) {
          dynamic_sidebar( 'custom-sidebar' );
        }
        ?>
    4. Set Up TypeScript Build Process:

      • Initialize NPM in Theme Folder:

        • Open a terminal in your theme directory and run npm init -y.

      • Install Dependencies:

        • Install Webpack and TypeScript:

          npm install --save-dev webpack webpack-cli typescript ts-loader
      • Configure TypeScript:

        • Create tsconfig.json:

          {
            "compilerOptions": {
              "target": "es5",
              "module": "commonjs",
              "outDir": "./dist",
              "strict": true
            },
            "include": ["src/**/*"]
          }
      • Set Up Webpack Config:

        • Create webpack.config.js:

          const path = require("path");
          
          module.exports = {
            entry: "./src/index.ts",
            module: {
              rules: [
                {
                  test: /\.tsx?$/,
                  use: "ts-loader",
                  exclude: /node_modules/,
                },
              ],
            },
            resolve: {
              extensions: [".tsx", ".ts", ".js"],
            },
            output: {
              filename: "bundle.js",
              path: path.resolve(__dirname, "dist"),
            },
          };
      • Add Scripts to package.json:

        "scripts": {
          "build": "webpack",
          "watch": "webpack --watch"
        }
    5. Add Interactive Elements Using TypeScript:

      • Create src/index.ts:

        • Example code:

          document.addEventListener("DOMContentLoaded", () => {
            const element = document.getElementById("interactive-element");
            if (element) {
              element.addEventListener("click", () => {
                alert("TypeScript is working!");
              });
            }
          });
      • Build and Include Script:

        • Run npm run build.

        • Enqueue the script in functions.php:

          function enqueue_my_scripts() {
            wp_enqueue_script( 'my-typescript', get_template_directory_uri() . '/dist/bundle.js', array(), '1.0', true );
          }
          add_action( 'wp_enqueue_scripts', 'enqueue_my_scripts' );
      • Add an Element to Test Interaction:

        • In your template file (e.g., index.php), add:

          <button id="interactive-element">Click Me</button>
  • Resources:


Thursday: Presentation Preparation and Delivery

  • Objectives:

    • Prepare and deliver a 20-minute presentation showcasing the custom theme.

    • Continue normal development activities.

  • Activities:

    1. Morning Development:

      • Enhance Theme Features:

        • Refine your theme based on previous work.

        • Add any additional features or styling improvements.

      • Debug and Test:

        • Ensure all features are working as expected.

        • Test across different browsers and devices.

    2. Presentation Preparation (1 hour):

      • Summarize Work Done:

        • Create an outline highlighting key features and customizations.

      • Prepare Presentation Materials:

        • Create slides if necessary.

        • Set up a live demo environment.

      • Rehearse:

        • Practice delivering the presentation within the time limit.

    3. Deliver the Presentation (20 minutes):

      • Presentation Content:

        • Introduce your custom theme and its purpose.

        • Demonstrate key features and customizations.

        • Discuss challenges faced and solutions implemented.

      • Engage with the Audience:

        • Encourage questions and feedback.

    4. Afternoon Development:

      • Implement Feedback:

        • Incorporate any useful suggestions received during the presentation.

      • Continue Development:

        • Proceed with the next planned activities.

  • Resources:


Friday: Working with WordPress Database

  • Objectives:

    • Learn to interact with the WordPress database using PHP.

    • Understand data sanitization and security best practices.

  • Activities:

    1. Using $wpdb for Database Queries:

      • Global $wpdb Object:

        • Access the database using $wpdb.

      • Retrieve Data:

        global $wpdb;
        $results = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}posts WHERE post_status = 'publish'" );
        foreach ( $results as $post ) {
          echo $post->post_title;
        }
      • Display Data in the Theme:

        • Create a custom template or modify an existing one to display the data.

    2. Create a Custom Table:

      • Register Activation Hook:

        register_activation_hook( __FILE__, 'create_custom_table' );
        function create_custom_table() {
          global $wpdb;
          $table_name = $wpdb->prefix . 'custom_table';
          $charset_collate = $wpdb->get_charset_collate();
        
          $sql = "CREATE TABLE $table_name (
            id mediumint(9) NOT NULL AUTO_INCREMENT,
            time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
            name tinytext NOT NULL,
            email VARCHAR(100) NOT NULL,
            PRIMARY KEY  (id)
          ) $charset_collate;";
        
          require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
          dbDelta( $sql );
        }
    3. Create a Form to Save Data:

      • Display Form Using Shortcode:

        function custom_form_shortcode() {
          ob_start();
          ?>
          <form method="post">
            <?php wp_nonce_field( 'submit_form' ); ?>
            <input type="text" name="name" placeholder="Name" required>
            <input type="email" name="email" placeholder="Email" required>
            <input type="submit" name="submit_form" value="Submit">
          </form>
          <?php
          return ob_get_clean();
        }
        add_shortcode( 'custom_form', 'custom_form_shortcode' );
      • Handle Form Submission:

        function handle_form_submission() {
          if ( isset( $_POST['submit_form'] ) ) {
            // Security check
            if ( ! wp_verify_nonce( $_POST['_wpnonce'], 'submit_form' ) ) {
              die( 'Security check failed' );
            }
        
            global $wpdb;
            $table_name = $wpdb->prefix . 'custom_table';
            $name = sanitize_text_field( $_POST['name'] );
            $email = sanitize_email( $_POST['email'] );
        
            $wpdb->insert(
              $table_name,
              array(
                'time' => current_time( 'mysql' ),
                'name' => $name,
                'email' => $email,
              )
            );
          }
        }
        add_action( 'init', 'handle_form_submission' );
      • Display Submitted Data:

        • Create a shortcode or admin page to display the data from the custom table.

    4. Understand Data Sanitization and Security:

      • Sanitize Inputs:

        • Use sanitize_text_field(), sanitize_email(), etc.

      • Prevent SQL Injection:

        • Always prepare queries or use helper methods.

      • Use Nonces:

        • Protect against CSRF attacks by using nonces.

      • Escape Outputs:

        • Use esc_html(), esc_attr(), etc., when outputting data.

  • Resources:

Windows Users: Download and install .

Mac Users: Download and install .

Get the latest version from the .

Review the .

Simple demo of react and .NET project
Demo of a more complicated backend with a database
XAMPP
MAMP
official website
PHP Manual
W3Schools PHP Tutorial
Installing WordPress Locally (WPBeginner)
WordPress File Structure Overview (Official Docs)
Template Hierarchy diagram
Creating a Basic Theme (ThemeShaper Tutorial)
Understanding The Loop (Official Docs)
WordPress Template Hierarchy (Official Docs)
Custom Page Templates (Official Docs)
WordPress Menus and Widgets (WPBeginner)
Webpack and TypeScript Setup Guide (DigitalOcean)
Using TypeScript with WordPress
Effective Presentation Tips
Demo Guidelines
Using $wpdb (Official Docs)
Database Security Best Practices (Official Docs)
Nonces for Security (Official Docs)