Peter Knight Posted October 24, 2014 Share Posted October 24, 2014 Does ProcessWire support PHP includes when they are called from a text field? I've created a field called Inject Include and added a PHP Include call within that. Right now, the ouput on the front end is my PHP include wrapped in HTML comment tags. <!--?php include("includes/get-graduates-main.inc"); ?--> BTW I'm trying this because HannaCode doesn't seem to be supported by 2.5. Otherwise, I'd have a HannaCode in the text field. Link to comment Share on other sites More sharing options...
SiNNuT Posted October 24, 2014 Share Posted October 24, 2014 It's possible, only not recommended. Take a look at this thread https://processwire.com/talk/topic/3004-is-there-any-way-to-execute-php-loaded-from-textarea-fields/?p=29541 If you lose the opening and closing PHP tags in your 'Inject Include' code, you can use php eval, http://php.net/manual/en/function.eval.php to execute the code in the template. But you really should be using Hanna (which should work also in 2.5.5) or maybe http://modules.processwire.com/modules/markup-shortcodes/ 2 Link to comment Share on other sites More sharing options...
diogo Posted October 24, 2014 Share Posted October 24, 2014 Hanna code is the way to go, and should work with 2.5 2 Link to comment Share on other sites More sharing options...
SiNNuT Posted October 24, 2014 Share Posted October 24, 2014 Peter has got it running using HannaCode, https://processwire.com/talk/topic/3745-hanna-code/?p=77895 To conclude: In general, never use the eval method mentioned here people! 2 Link to comment Share on other sites More sharing options...
Joss Posted October 24, 2014 Share Posted October 24, 2014 Yep, Hanna - she is much safer. If you want to make it less techy, you could create a drop down with preset values that are then written into the template with the logic: If include value is "Graduate" include this file 1 Link to comment Share on other sites More sharing options...
Peter Knight Posted October 24, 2014 Author Share Posted October 24, 2014 Thanks guys. I'd prefer to use HannaCode here too. Much less to type for starter. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now