Posts in category “Website Dev”

Grav Development: Part 2 - Porting a header


So after a bit of reading on how twig works I've started diving in and making some modifications for the theme I created in Part 1 of this series of posts. You're basically going to be seeing my build process for a new website, which I have no problem sharing because I'd love if something I do helps someone struggling with something similar.

So the first point to check off was to get a header working. I had a static page I had been working up for my new personal website that I've decided to use as my test bed for this process. This is going to be an interesting challenge because I'd planned to have a landing page which is separate from the normal homepage. Let's see how that works out but I've got a plan in case it doesn't go the way I think.

So here's the static version I was aiming to port over. The header block I was aiming to transfer

And here's the same code section incorporated into Grav. The header block after being transferred

I'm not showing any screenshots of the end result just yet, not ready to show anything off at this stage. So far so good though. Time to start working on the actual content section and see what kind of magic can happen there with different templates!

Bye for now. Scott.

Grav Development Part 1: Getting Started


So I've been messing around with Grav for a few days now and believe I'm at a point I can start talking about where I thought I'd hit a wall but ended up finding a pretty easy workaround that made me feel like a bit of an idiot.

Firstly I should point out that Grav's Documentation is more than enough to get anyone going, the important thing is actually reading it and understanding everything. That's going to be the next challenge now I'm over the initial hurdle of getting themes up and running. Chapter 3 is where I've been hanging out most of the time I've been looking into it (when I haven't been just poking around the Admin Panel getting a feel for it). Having a read of the Twig info is actually helping me get my head around how that actually works, and I'm quite keen to see if I can things working for my new personal website how I want them to with what Twig and it's functions is looking like it's capable of.

First things first though, I had to get a theme up and running. So I followed the instructions on this page to get me started. This was where I hit my first hurdle. I could get DevTools installed through the ACP no problem, but how was I going to access the CLI? I could work it in for CMD Prompt to use PHP. Initially I abandoned the idea and just duplicated the Quark theme and started plugging away modifying stuff to my liking. But the more I thought about it the more I knew I wanted to know the whole process. So I came back to it and looked a bit further into it.

This is where the "ending up feeling like an idiot" comes into play. As I'm using Laragon for my local development environment the program comes preconfigured with a terminal emulator called Cmder, Linux/GNU based commands come at me! How I didn't think of that before was beyond me but now we're cooking with gas! Very important to note that the commands still need to be written with php leading the command, so what the documentation says, but with php in front (prepend? Is it prepend as the opposite of append?) to actually make it work. Like this:


λ php bin/gpm install devtools

You'll see in my screengrab below that I had a bit of trial and error before I figured that out. Then I went through the steps described in the documentation to create the new theme:

Test Theme Creation

Everything has come up roses, the new theme works nicely so now I can move on to the HTML and CSS and working out how Twig works with it. Fun times ahead!

CMS Options. An Exploration in Future Development Choices


So I mentioned in my last post about getting a few CMS's together and working on drilling down on seeing how they work and getting into developing for them. I'm happy with my list at this point and think that I'll be looking at the following systems in the following order:

  • Grav - As far as flat-file CMS's go, it was out of Grav or Bolt. Bolt seems nice so given they both use Twig for templating it's highly likely I may look into Bolt at some point in the future as well. I just liked the look of Grav and I'm pretty sure I found it before Bolt so it had the running lead and became first pick.
  • ForkCMS - For something to move into a CMS that isn't Wordpress (which I've excluded from this list because I've got a fairly good idea already for styling and developing for it) I've chosen Fork. It seems like it's straight forward for non-developers to use, which is an important consideration when working with people who just want to be able to build pages or post news without having to jump through hoops or complex interfaces. Some other options here were Concrete5 or ModX. I'd used ModX once before and didn't like it that much at the time, that was quite a few years ago now so it's probably changed a fair bit (or at least my perception on things probably will have). Concrete5 is another option I'd probably look at down the line similar to Bolt/Grav.
  • Typo3 - I'd be a long way off learning this one, but for enterprise-level solutions Typo3 seems like a powerful option. It looks complicated from an administrative standpoint though so I'm guessing this would be more of a personal exploration project, at least initially, before I consider doing anything with it.

So I've got Grav for small-scale websites, ones that may be updated occasionally with new content and pages but not so heavily to require a database or complex ACP. Fork for medium-scale, where a database for managing pages, posts and media would be useful for site admins, but not overly complicated in terms of functionality and permissions to actually use the site. And Typo3 for eventual large-scale projects, the kind that would probably need more than one developer to be honest, which is why it's so far down my list on things to learn.

The advantage is that they all use Twig, so learning that will at least be a transferable skill to the others - short of system-specific elements - to cut down a bit on adapting to the new system.

I'm starting with Grav as I'm looking at using that for my new website. Like I said, Wordpress hasn't been the greatest choice for something so basic. A combination of Grav and this blog should be more than suitable to do everything I need. I thought about starting with Fork, but from a usability standpoint it's very similar to the new system we're going to be using at work so I've got no dramas leaving that for a bit so I don't confuse myself between the two.

In the interim I'm in the market for some new screens so I'm looking at ones that will be good for developing with. I was going to go 1440p so I could get high refresh rates for gaming, but I'm increasingly realising that I do more development than gaming so I'm prepared to sacrifice refresh rate and bump up to 4K for more screen real estate. More on that another time though.

That's all for now, see you in the next one, Scott.