💻
Code Zero Project
  • introduction
  • Welcome
  • getting started
    • apa itu mini mvc php native
    • Installation
  • architecture consept
  • database
    • PDO
    • connection
    • migrations
    • query builder
    • result database
  • basic
    • models
    • controller
    • view
    • routing
    • markdown
  • helper
    • session
    • input
    • maintenance
    • debug
    • waktu
    • agent
    • email
    • get_rest_api
    • upload directory
    • asset
    • 404
    • redirect
    • random file name
    • url
    • slug
    • upload files
    • read markdown
    • Security
  • frontend
    • basic html
  • libraries
  • science
    • mathecmatic
    • ML
  • command shell
  • API
  • donation
  • about
Powered by GitBook
On this page
  • markdown file
  • path
  • basic usage
  • basic usage with controller and view
  1. helper

read markdown

markdown file

update function baru untuk membaca file markdown dan melakukan convert ke HTML, function ini dibuat untuk tujuan membaca markdown files, terlebih lagi untuk dalam pembuatan documentation program.

path

base path untuk markdown files terletak pada directory views/markdown

basic usage

<?php
// call function
read_markdown("name of markdown file withoud extention");

// example
// read file example.md
read_markdown("example");

basic usage with controller and view

untuk menggunakan bersama controller dan view

  1. buat controller

  2. buat template views pada directory views

  3. buat file .md atau pada directory markdown

controller

contoh file controller

<?php
namespace app\controllers;

use MiniMvc\Apps\Core\Bootstraping\Controller;
use MiniMvc\Apps\Core\Bootstraping\Request;
use app\controllers\email\mailer;
use MiniMVC\System\Storage;

class welcome extends Controller
{

	public function __construct()
	{
		// code here
	}

	public function index()
	{
		//echo "controller welcome method index";
		$data  = [
			"title" => "read markdown files",
			"markdown_content" => read_markdown("example")
		];

		view("example_v", $data);
	}

}

view

contoh file views

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- show title -->
    <title><?= $title ?></title>
</head>

<body>
    <!-- show markdown file -->
    <?= $markdown_content ?>
</body>

</html>

markdown

contoh file markdown

### this is example

<p>markdown file basic</p>

route

contoh arah route

//  default welcome
$router->get('/', function () {
    // return view('Welcome'); # langsung view
    Routes::Routing("welcome", "index"); # panggil controller
});

Previousupload filesNextSecurity

Last updated 3 years ago