From: http://www.tantengvip.com/2013/12/phpcms-php-function/
Phpcms Background Content Module---Model Management--add field function is very powerful, you only need to operate in the PHPCMS background panel, do not have to manually build tables in the database, do not operate the database to add or delete fields, added the fields and types, publish content, The fields and types you want are automatically displayed on the form, which makes it a lot easier, including forms validation, sorting, and so on.
Phpcms also provides a field called the Universal field, where the user can customize more functions of the field.
To set up a custom form:
<input type= ' text ' name= ' info[game_swf] ' value= ' {FUNC (Show_date~~{field_value})} ' >
For example, there is a text box, I need to fill out the form, the box in the default display a path,/yx/swf/201312/, and then manually fill in the following content, so can only select the Phpcms in the Universal field, but value cannot write {php ...} Such a form, also can not use <?php ...? > Grammar, it will filter out for you.
This time to use the PHPCMS provides a way to call the function, the syntax is {FUNC (function~~params)}, so you can invoke the custom Php method, function is the name of the functions, two ~ ~ followed by parameters.
For example, I added a function in the phpcms extension function file extension.func.php:
/*/function show_date ($field) {if(' = =$ Field) { return '/yx/swf/'. Date("Ym"). ' /'; } Else { return$field; }}
Its function is to pass in the form's value, {Field_value}, and if it is empty, display '/yx/swf/'. Date ("Ym"). ' /', otherwise the edit is displayed as is. This solves the problem.
This is where the almighty field is all about.
Phpcms How to use PHP methods for universal fields