Intergrating Static Site generators with php

孤街浪徒 提交于 2020-01-01 03:27:44

问题


I'm currently building a website using php that won't need regular updating and I thought of using static site generators as it will have a blog like feature. However my website contains a form the will link with a database and the problem i'm having is that the static site generators don't recognize and parse php.

I am currently considering using one of three static site generators -Jekyll -wintersmith - Piecrust

I was wondering if this can be done or are static site generators just for static pages


回答1:


In Jekyll, you can use the {% raw %} tag to avoid processing a specific part of your files. For example:

This will be {% raw %}<?php echo("parsed"); ?>{% endraw %} correctly.

After processing, the above should be translated to This will be <?php echo("parsed"); ?> correctly.




回答2:


If you are hosting Jekyll generated website into a regular web server with php, you might need to generate index.php instead of index.html.

To do so, you can define permalink in that exact page in the front matter area:

---
layout: default
title: Some page title
permalink: somelink/index.php
---


来源:https://stackoverflow.com/questions/19124309/intergrating-static-site-generators-with-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!