HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

allow_php_in_templates

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#77265 (In Topic #15898)
Avatar

Fan in training

Hello!

So I tried to add a PHP code in the header, and I got this message:
The hidden allow_php_in_templates option is not turned on, so PHP code in templates will not run. The option is described in the ocPortal Code Book, available from ocportal.com. The standard practice for your use case is to create and reference a miniblock, as it separates concerns well, promotes re-usability, and provides a security barrier.

How do I enabled allow_php_in_templates? And how do I create a miniblock? I do not have any experience with PHP and stuff, all I wanted to do is to do add a Php include.

Hope to hear from you soon!

Jason
Back to the top
 
Posted
Rating:
#77267
Avatar

Community saint

To set a hidden value to true, open up OcCLE (under the 'tools' section in the Admin Zone or clicking the symbol at the bottom-left of any page) and type :set_value('<name>','1')

So to enabled allow_php_in_templates you would type:

Code

:set_value('allow_php_in_templates','1')
in the OcCLE command prompt.

Note that it is not recommended to enable allow_php_in_templates as it is a security risk as described in the Code Book as follows:
This allows you to write PHP code inside templates, but please aware there are strong risks associated with this. It means that themes you install may contain PHP code, or people submitting Comcode content may put in PHP code which you could accidentally unwittingly activate when validating content (as it
would be validated against your own security credentials).
As for miniblocks, see Creating Miniblocks from Third-Party Code - ocPortal

Visit Last Gamer because its made with ocPortal.

Stay for the content - Video game retrospectives, reviews, galleries and discussions.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: