PHP code example of savvywombat / caxton

1. Go to this page and download the library: Download savvywombat/caxton library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

savvywombat / caxton example snippets


---
title: Example document
---

@extends('_layouts.html')

@section('content')
  <p>Hello World</p>
@endsection

---
title: About Markdown
---

@extends('_layouts.html')

@section('content')

This is Markdown.

@endsection

<html lang="en">
<head>
    <title>{{ $title }}</title>
</head>
<body>
    @yield('section')
</body>

<ul class="index">
    @foreach ($site->index('blog')->slice(0, 3) as $post)
        <li>
            <a href="{{ $post->url() }}">{{ $post->data('title') }}</a>
            
            <p class="date">{{ $post->data('date') }}</p>
            
            <p>
                {{ $post->data('description') }}
            </p>
        </li>
    @endforeach
</ul>

@foreach ($site->index('blog')->sortByDesc(fn($post) => $post->data('date')) as $post)

@foreach ($site->index('blog') as $page)