I'm trying to get a small set of php fu开发者_JAVA技巧nctions working that i need available on the entire page. I'm including them in my index.php main template via require_once "my_functions.php"
.
They work in the index.php template; that's the good news.
We have a plugin that let's us write php in our content items with the following syntax:
{source}<?php echo "hello world!"; ?>{/source}
However, when trying to use the functions defined in my_funcitons.php, php thinks they're unavailable and generates a fatal error ... undefined method or function
.
Any ideas?
I do believe you should write a module, implement your require_once
inside it and insert the created module in articles.
Avoid creating too much php code in WYSIWYG editors, you're mixing content with programming logic, defeating CMS's purpose: manage content. And if you have non-technical people behind your system this can become a real headache in the future.
Try using Direct PHP.
精彩评论