最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - Using custom field content as expression in IF statement

matteradmin8PV0评论
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

I want to store some conditional logic in custom post types , and then use these in a plugin to generate new content based on the logic.

Eg if a user submits a form with “body temperature”, a conditional logic will tell the user if she has a fever or not, and some extra text.

There will be many such logic elements and I would like to maintain them from the front end.

I was thinking about putting the above into two posts. One with condition field “temperature > 37” and text “you have a fever”. Then in a plugin loop through logic records, take the conditional field and use it as the expression in an if statement.

How to make this work?

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

I want to store some conditional logic in custom post types , and then use these in a plugin to generate new content based on the logic.

Eg if a user submits a form with “body temperature”, a conditional logic will tell the user if she has a fever or not, and some extra text.

There will be many such logic elements and I would like to maintain them from the front end.

I was thinking about putting the above into two posts. One with condition field “temperature > 37” and text “you have a fever”. Then in a plugin loop through logic records, take the conditional field and use it as the expression in an if statement.

How to make this work?

Share Improve this question asked Apr 4, 2019 at 6:04 KCarterKCarter 113 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I asked the question in another group and here I got an answer that has turned out to be useful.

BE AWARE! It must be dealt with with caution as the PHP eval() function can be a significant security risk.

Find the answer here: https://stackoverflow/a/55518496/11309498

Post a comment

comment list (0)

  1. No comments so far