我将 HTML 内容存储在具有文本数据类型的 MySQL 字段中,并且我使用 ckeditor 作为 WYSIWYG 编辑器来创建存储在 MySQL 中的 HTML。我正在寻找一种方法让用户放置某种我可以查找并替换为调用包含文件的字符串。例如:
// This string contains the text pulled from mysql
$pageContent = "<p>This page contains a calendar of events</p> {{calendar}} <p>Choose a date or scroll through days to view events.</p>";
// Function needed that changes {{calendar}} to bring in my script calendar.php like include('calendar.php');
// Note that in this example I want to call my script that does the calendar stuff, but maybe I have a script to do a photo gallery which could be {{photogallery}}, or news {{news}}, or whatever...
// Print the $pageContent including the calendar.php contents here
print $pageContent;