I am trying to figure out, what PHP tag pre-processor would be used to handle something like this:
{icon}eating {object} at {place-icon}{place-name} with {name1} and {n-more-recipients}.
Or,
{name} shared a link.
I know, that one could use an array[], with preg_replace and replace matching {tag} with a value through a foreach-loop.
What would be an efficient way to implement something like this? Can this be done in OOP? Should those texts be stored in a txt file of some kind and then read to an array?
I appreciate tips, suggestions, and links to good articles.
Now you know that I have a template engine. With that said, I am out for LANGUAGE support. That being said. I am curious, if letâs say: Activity Verb Definitions are to be defined in a TXT file and read into an array along with the tags that are replaced.
Personally, Iâm more confused now than before. And Iâm pretty sure no one is appreciating your attitude.
So⌠are you trying to make placeholders such as {name} that you insert values into? Or are you trying to parse the grammar of a sentence to extract the verbs and nouns?
Based on the screenshot, my guess is you want to make placeholders such as {name} that you insert values into. In which case a template engine is indeed what you want.
I have one Iâve built from the ground up, in PHP. It works well. However, this is something else, this has to do with STRING definitions in different languages. See my last reply, it includes examples. Thx.
No. Letâs say, I have this line: {name} merged pull request {=request}. defined and saved in a TXT file, so based on userâs language preferences, I read the file that includes string text definitions into an array, then based on user activities, I generate a feed, where I replace e.g. {name} with the name of a user that did something to an object.
I still donât see how. To be more exact, to me a template engine is one used to render the whole site. Maybe my definition is poor. I am still curious to know more about TEXT string pre-definitions in files.
Explain to me, how, texts like this would be defined within a traditional HTML template engine.
Hahahahaha! Still I am not convinced that a traditional Template Engine would be used for this kind of job. Picture this, support multilanguage UI as well.
English: {user1} started following {user2}.
German: {user1} angefangen zu folgen {user2}.