The CS4MS+ website is used to disseminate resources to K-12 educators for teaching computer science topics. Live site is hosted at https://www.cs.bsu.edu/cs4ms/.
It is recommended that the project be run on an Apache web server with PHP 7.4+.
-
Install the Apache web server.
-
Use a terminal/command prompt window to navigate to the server's public HTML directory.
- Windows:
cd C:\xampp\htdocs - macOS:
cd /Applications/MAMP/htdocs - Linux:
cd /var/www/html
- Windows:
-
Clone the repository by typing
git clone https://github.com/dllargent/CS4MS-Website.git. -
Start the Apache server.
- Windows: open the XAMPP Control Panel and click the
Startbutton to the right of the Apache module. - macOS: Open the MAMP Control Panel and click the
Start Serverbutton. - Linux: Apache should already be running.
- Windows: open the XAMPP Control Panel and click the
-
Visit http://localhost/CS4MS-Website in your browser, and the website should appear. The port number can vary, check the server's configuration. On MAMP, it may be http://localhost:8888/CS4MS-Website by default.
- After installing the Apache server, install PHP by running
sudo apt install -y php libapache2-mod-php. - Open the Apache configuration file in the nano editor by typing
sudo nano /etc/apache2/apache2.conf. - Find the tag that begins with
<Directory /var/www/>. Change the line that saysAllowOverride NonetoAllowOverride Alland save changes. - Back in the terminal, type
sudo a2enmod rewrite && sudo systemctl restart apache2. - Resume at step 2 in Set Up.
To reduce code duplication, the project was converted to PHP through which the site is rendered.
The files about.php, index.php, resource.php, and standards.php are entry points to the site
that handle the rendering of their respective sections.
They use a variety of custom Utils seen in the utils/ folder.
Util.phpfinds the document root for the site, so it works at whatever level it is installed.Navbar.phprenders the navbar. It dynamically adds the dropdowns and adds a search bar if the methodaddSearchBar()has been called on the navbar object.Head.phpcontrols the<head></head>content for every page. It has various helper methods.addScript(scriptname)will add the script to the head, so it will be loaded for that page. The scripts MUST be in thescripts/directory. Example use:$head->addScript('hello-world')will add hello-world.js to the head.addStyleSheet(stylesheet)will add the stylesheet to the head. It works the same way asaddScript()except it expects styles to be in thestyles/directory.
Directory.phphandles converting specified directories into dropdown links for use in the navigation bar.File.phpconverts files in specified directories into navigation bar links inside of a dropdown menu.Dropdown.phpdynamically renders the dropdown functionality. Directories in the specified sections are rendered as the actual dropdowns, while the files inside them are rendered as pages for the user to visit.
CSS files to be used for the website.
JavaScript files to be used for the website.
The Pages directory holds the HTML content for the separate pages. For Resources and Standards, it will dynamically create a dropdown in the navigation bar based on the directory structure.
Add a file or a folder, and it will appear in the dropdown. When clicking on a file, it will load it into the
<body></body> section of the website.
Images for the website.
Documents referenced on the website.
This contains HTML files for reused components across the site. If the head, footer, or navbar files are changed here, they will change on every page.
bootstrap.phpis responsible for defining theBASE_URLconstant and should always be kept in the project's root directory..htaccessredirects each of the links in the navigation bar to their respective pages. It has also been configured to prevent some file extensions from being displayed in the URL bar (e.g..php).
To deploy an updated version of the project to the live site, developers have the following options:
The live site is a cloned repository. To update it, simply use a terminal to navigate inside the project directory on the remote server and type git pull. This will pull the updated content from the master branch.
This project previously used continuous deployment, but the deployment server has since been taken offline. To inquire about bringing it online again, please contact Spencer Davis (psdavis@bsu.edu).
- Testing Framework
- Future developers: This project has had some issues with deployment to the live site in the past. It would be in your best interest to set up a testing framework before making any modifications to the PHP code, which will ensure that everything is working correctly before a new version is deployed. Please remove this section from the README once a testing framework has been implemented.
NOTE: The CS4MSPromoVideoCC/CS4MSPromoVideoCC.mp4 file is not included in this repository, as it is too large. To obtain it, please contact Dave Largent (dllargent@bsu.edu).