Giter Club home page Giter Club logo

acme-university's Introduction

ACME University Website

Just learning the basics of building websites using PHP.

ACME University

Resources

What I Learnt!

So in the includes folder, I would have a config.php that looked like this:

For Local Developement

<?php 
	define("BASE_URL", "/{{Folder_Name}}/");
	define("ROOT_PATH", $_SERVER["DOCUMENT_ROOT"] . "/{{Folder_Name}}/");

	$header_path = ROOT_PATH . "_includes/header.php";
	$footer_path = ROOT_PATH . "_includes/footer.php";
	$sidebar_path = ROOT_PATH . "_includes/sidebar.php";
?>

For Actual Server

<?php 
	define("BASE_URL", "/{{https://website.com}}/");
	define("ROOT_PATH", $_SERVER["DOCUMENT_ROOT"] . "/");

	$header_path = ROOT_PATH . "_includes/header.php";
	$footer_path = ROOT_PATH . "_includes/footer.php";
	$sidebar_path = ROOT_PATH . "_includes/sidebar.php";
?>

You can also check for your development environment by using $_SERVER["REMOTE_ADDR"].

	if($_SERVER["REMOTE_ADDR"] == "::1"){ /*LOCAL CODE*/ }
	else{ /*SERVER CODE*/ }

Page Content: Now in every page you just need to include this

<?php
	$page = "home";
	//now we can use our config file
	require_once("path/to/config.php");
	include($header_path");
?>

<!--now we can continue our file with the content of this page here-->

<?php include($footer_path); ?>

acme-university's People

Contributors

avionics18 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.