Hello, how add PHP code on the page?
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
PHP lives in the mysite folder, with files that have the same name as your ss file.
So
MyPage.php
class Mypage_controller extends Page_controller
{
function Hello()
{
echo "Hello, how are you?";
}
}
MyPage.ss
$Hello // outputs "Hello, how are you?"
Maybe there is a addon for tinymce?
No there is no "add on for tinymce" as this is designed for editing HTML content.
codemonkey88 has given an excellent brief example and I would encourage you to consider that more and maybe complete all the tutorials and then return and you should then understand more.
Of course I could have misunderstood as you posts are quite vague as to what you are trying to do...
Hi Berk,
Are you asking how to display syntax highlighted code as content on a page perhaps?
You can use the <code> tag in your html content and simply apply some css style or perhaps a javascript syntax highlighting plugin over the page (for example https://highlightjs.org/).
Hope that helps.