Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Compile PHP Site into static HTML

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #179785
    Anonymous
    Inactive

    Hi!
    I have a personal site built in PHP. The PHP itself isn’t advanced, it’s nothing else than lots of include()/require() to simplify the structure of the site for myself. (ex. header.php, footer.php, nav.php, javascript.php, googleanalytics.php and many more, making up a total of 13 php files)
    Is there any way I can easily compile all this into static HTML through some sort of build process, a bit like SASS does with the @imports of SCSS when compiling to CSS? I have no experience with node.js nor grunt, but I wouldn’t mind to get some.

    The reason I want to do this is to minimize server response time.
    (I am using a PC)

    Best Regards,
    Wilhelm

    #179811
    Alen
    Participant

    If you have handful of pages, load the site in your browser, visit each page and save it.

    If you have lots of pages, I’m sure there is some kind of build tool you could use. I haven’t really needed one so can’t help you there. Maybe someone else can chime in.

    #179850
    shaneisme
    Participant

    I think what you’ll probably want is a static site generator.

    Jekyll is (probably) the most popular: http://jekyllrb.com/

    For another solution that includes Grunt, et al, I found this walkthrough to be particularly well done: http://davidtucker.net/articles/move-to-static-site-generator/ (1 of 3)

    Getting this stuff up and running opens up so many new worlds and you’ll level up your workflow like never before.

    #180170
    Anonymous
    Inactive

    Thanks for all the replies! The problem with those are that they require templating languages and configuration files, much more than I need.
    I found this article, which helped me get the final result that I wanted :)

    Best regards,
    Wilhelm

    #198598
    Taufik Nurrohman
    Participant

    Use output buffers. Try this snippet → hxxp://www.catswhocode.com/blog/how-to-create-a-simple-and-efficient-php-cache

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.