Hello,
my environment Apache 2.4, PHP 7, Joomla 3.6 and all latest CB Add-Ons.
I tried to create a Tab for user where PHP script will be placed.
I've create a tab PHP and create field CODE using CB Code plugin.
As krileon said "It only executes PHP so anything you can do from PHP you can do from a Code field. Please keep in mind it executes your string as an anonymous function so you don't need php tags."
OK, under Parameters of CB Code field I placed a simplest PHP code
print "Hello World!";
But nothing appear on frontend under user "PHP" Tab. CB Code plugin is published.
Please, advise any idea why it happens and how to execute a PHP code.
Last edit: 8 years 4 weeks ago by krileon. Reason: Added [SOLVED] tag to subject
It adds your PHP as an anonymous function then executes it while being surrounded by ob functions. Your print output isn't going to do anything because it's self contained using the ob functions. It outputs the return value of the anonymous function so if you want anything to output you need to do a return. Example as follows.
Code
Code:
return 'Hello World!';
See the below to understand how anonymous functions and ob functions work.
CB Code Field does have output templates though so you could always make a template file that handles the code however you want.
Kyle (Krileon) Community Builder Team Member Before posting on forums:
Read FAQ thoroughly
+
Read our Documentation
+
Search the forums CB links:
Documentation
-
Localization
-
CB Quickstart
-
CB Paid Subscriptions
-
Add-Ons
-
Forge
-- If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
-- If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please
send me a private message
with your thread and will reply when possible!
-- Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
-- My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.