At the moment my cms system that I've built works by taking the main content from a database and putting it in the template. This is fine generally but I've hit a small problem...
I want to have php code in some of the pages. Mainly to generate some forms and process them. I want the sql content entry simply to be as follows:
content content content {addform(enquiry)} content content content
When the page loads it should simply display the content, but anything inside the {} it should process.
For now {addform} could simply be replaced by some html code (text), but in the future I'll need it to be able to pass parameters, e.g. addform(enquiry) will be replaced by an enquiry form, addform(prices) will be replaced by a price form etc.
Some pointers as to how to do this would be very much appreciated. Thanks.
parsing sql data on a content management system
Moderator: General Moderators
-
djot
-
Code: Select all
<?php
function Name()
{
return "fpj05";
}
$output = "Hello, my name is {name}.";
$output = str_replace("{name}", Name(), $output);
echo $output;
?>djot
-