Skip to content

Instantly share code, notes, and snippets.

@bgarrant
bgarrant / How-to-setup-PHPStorm-for-Statamic-Antlers.md
Last active Sep 11, 2021
How to setup PHPStorm for Statamic Antlers
View How-to-setup-PHPStorm-for-Statamic-Antlers.md

How to setup PHPStorm for Statamic Antlers

If any PHPStorm users want better syntax coloring for Antlers I figured out a better way.

  1. Install Handlebars/Mustache plugin and enable the checkbox for “Open HTML files as Handlebars/Mustache” under Languages & Frameworks > JavaScript > Templates. Not perfect but much, much better!

  2. This makes it even better. Disable Inspection and Syntax for Handlebars by click on Hector icon and changing the Highlighting Level for Handlebars to "None". Now no inspection errors!

  3. Enjoy Statamic Antlers inside .html files in PHPStorm.

@bgarrant
bgarrant / How-to-Setup-Multi-Day-Events-with-a-Daily-Schedule-in-Statamic.md
Last active Aug 29, 2018
How to Setup Multi-Day Events with a Daily Schedule in Statamic
View How-to-Setup-Multi-Day-Events-with-a-Daily-Schedule-in-Statamic.md
@bgarrant
bgarrant / Automatic-Sitemap-XML-Generator-for-Statamic-CMS-Pages-and-Mounted-Collections.md
Last active Jul 28, 2020
Automatic Sitemap XML Generator for Statamic CMS Pages and Mounted Collections
View Automatic-Sitemap-XML-Generator-for-Statamic-CMS-Pages-and-Mounted-Collections.md

How to automatically generate a Sitemap XML file using Statamic CMS.

This method will work for all Pages and Mounted Collections (just like Pages view in CP).

  1. Create a template called sitemap.html and add it to your theme/layouts/ folder.
  2. Add the following code to the new template
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ nav from="/" include_home="true" include_entries="true" exclude="our-team" }}
@bgarrant
bgarrant / Bootstrap 4 Navbar with Statamic 2.x CMS.md
Last active Aug 29, 2018
Bootstrap 4 Navbar with Statamic 2.x CMS
View Bootstrap 4 Navbar with Statamic 2.x CMS.md

Bootstrap 4 Navbar with Statamic 2.x CMS

<nav id="mainNavigation" class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarContent">
@bgarrant
bgarrant / Multi-level Bootstrap 4 Navbar With Craft 3 (No Plugins).md
Last active Jul 30, 2019
Multi-level Bootstrap 4 Navbar With Craft 3 (No Plugins)
View Multi-level Bootstrap 4 Navbar With Craft 3 (No Plugins).md

Multi-level Bootstrap 4 Navbar With Craft 3 (No Plugins)

You want to setup a Bootstrap 4 Navbar and use native functions in Craft 3 to manage the navigation menu.

This was built for Bootstrap v4.0 and Craft CMS 3.0.0-RC9

Step 1: Install Craft 3

Go to https://github.com/craftcms/docs/blob/v3/en/installation.md and install Craft 3.

Step 2: Download and Install latest Bootstrap 4 build

@bgarrant
bgarrant / How-to-Setup-Cron-Task-to-Git-Commit-Statamic-Changes-Hourly-on-cPanel-Server.md
Last active Jan 27, 2018
How to Setup Cron Task to Git Commit Statamic Changes Hourly on cPanel Server
View How-to-Setup-Cron-Task-to-Git-Commit-Statamic-Changes-Hourly-on-cPanel-Server.md

How to Setup Cron Task to Git Commit Statamic Changes Hourly on cPanel Server

  • Login to your cPanel account (http://yourdomain.com/cpanel)
  • Click on Cron Jobs in the Advanced Section
  • If you would like to receive an email notification when a command produces output, please enter your email address under Cron Email at the top of the Cron Job setup page.
  • Under Add New Cron Job, select Once Per hour ( 0 * * * * ) from the Common Settings Drop Menu
  • Under Command: add cd /home/USERNAME/PATH/TO/REPO && git add --all && git commit -m "Automatic Hourly Commit"
  • Click Add New Cron Job button

If you would like do adjust the frequency, select a different option from the Common Settings Drop Menu or adjust the values for Minute, Hour, Day, Month, Weekday.

@bgarrant
bgarrant / How-to-setup-Statamic-above-document-root-on-cPanel-with-Git.md
Last active Aug 29, 2018
How to setup Statamic above document root on cPanel with Git
View How-to-setup-Statamic-above-document-root-on-cPanel-with-Git.md

How to setup Statamic above document root on cPanel with Git

This will install Statamic to your /home/USERNAME/ directory and have the needed public facing files files in your /home/USERNAME/public_html/ folder.

Setup your local Statamic environment to have the folder structure below

If you need help setting up above document root, please visit https://docs.statamic.com/knowledge-base/running-above-webroot.

local
public_html
|-- assets
@bgarrant
bgarrant / ExpressionEngine Laravel Valet.md
Last active Apr 14, 2020
How to setup Laravel Valet for an ExpressionEngine site needing PHP 5.6 or PHP 7.1 Support
View ExpressionEngine Laravel Valet.md
@bgarrant
bgarrant / ValetSwitchPHP.md
Last active Jun 30, 2021
How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6
View ValetSwitchPHP.md

How to Switch PHP Version in Laravel Valet between PHP 7.1 and PHP 5.6

Valet switch PHP version with these commands

Install PHP 5.6 and switch Valet to PHP 5.6

valet stop
brew unlink php71
brew install php56
brew install php56-mcrypt