Adding php into an entry

Adding php into an entry

โดย Jay S -
Number of replies: 4
I want to add the teacher variable into a glossary entry. The glossary is FAQ, below is an example of what I want to do.

Question: How do you do this?
Answer: only a $teacher would know.

As you can see, or not see I do not know the variable name. But that is not the problem here. The reason I want this done, is so when the teacher/instructor/facilitator is mentioned, it is consistent with the rest of the CMS.


การประเมินโดยเฉลี่ย: -
In reply to Jay S

Re: Adding php into an entry

โดย Martin Dougiamas -
รูปภาพของCore developers รูปภาพของDocumentation writers รูปภาพของMoodle HQ รูปภาพของParticularly helpful Moodlers รูปภาพของPlugin developers รูปภาพของTesters
PHP can not be included in text (and won't be anytime soon as the security implications are immense).

One thing you could do is create a new filter to search and replace words (this requires PHP programming, see the censor filter for an example). Then you could just use "teacher" naturally or invent a code word like "TEACHER" and let the filter sort out the course-specific word to use.
การประเมินโดยเฉลี่ย: -
In reply to Martin Dougiamas

Re: Adding php into an entry

โดย Jay S -
Can I use Javascript

If so, where do I put the function.


การประเมินโดยเฉลี่ย: -
In reply to Jay S

Re: Adding php into an entry

โดย Eloy Lafuente (stronk7) -
รูปภาพของCore developers รูปภาพของDocumentation writers รูปภาพของMoodle HQ รูปภาพของPeer reviewers รูปภาพของPlugin developers รูปภาพของTesters
Hi Jason,

as I understand, your idea cannot be realised using Javascript. You will need to write some custom code in the server to make such things to work. Martin pointed you in the correct direction (creating a new filter to replace some words) in his previous post.

Ciao smile
การประเมินโดยเฉลี่ย: -
In reply to Eloy Lafuente (stronk7)

Re: Adding php into an entry

โดย Jay S -

Im sorrry for being vague. I do not wish to use javascript for what I need accomplished above. I want to use window.open.

As for my problem above, I think that I can use the bad word filter, have it change any instance of teacher to instructor and so on.

การประเมินโดยเฉลี่ย: -