Fix guide template variable replacement and enhance documentation
- Fix template variable replacement in guide pages by removing {{}} brackets
- Escape code blocks in guide markdown to prevent template processing
- Completely rewrite guide documentation with comprehensive CMS features
- Add bilingual guide support (English/Dutch) with detailed examples
- Enhance CodePressCMS core with improved guide page handling
- Update template system with better layout and footer components
- Improve language files with additional translations
- Update configuration with enhanced theme and language settings
Resolves issue where guide pages were showing replaced template variables
instead of displaying them as documentation examples.
This commit is contained in:
@@ -37,6 +37,16 @@ class SimpleTemplate {
|
||||
// Handle partial includes first ({{>partial}})
|
||||
$template = preg_replace_callback('/{{>([^}]+)}}/', [$this, 'replacePartial'], $template);
|
||||
|
||||
// Handle equal conditionals first
|
||||
$template = preg_replace_callback('/{{#equal\s+(\w+)\s+["\']([^"\']+)["\']}}(.*?){{\/equal}}/s', function($matches) {
|
||||
$key = $matches[1];
|
||||
$expectedValue = $matches[2];
|
||||
$content = $matches[3];
|
||||
|
||||
$actualValue = $this->data[$key] ?? '';
|
||||
return ($actualValue === $expectedValue) ? $content : '';
|
||||
}, $template);
|
||||
|
||||
// Handle conditional blocks
|
||||
foreach ($this->data as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
|
||||
Reference in New Issue
Block a user