Php in a content

Permalink
Can i add php codes in a content?...
Because when i want 2 add something like this
<?php echo "Test"; ?> It wont work...

Joost
 
jgarcia replied on at Permalink Reply 1 Attachment
jgarcia
I've created a block for this actually. You just point the block to a php file in your files directory (you have to ftp that file to your files directory). This is probably not the best way to do it, but it was a quick easy way to accomplish the goal for me.
frz replied on at Permalink Reply
frz
typically you should be doing this type of thing in the template files in your theme.
Joost replied on at Permalink Reply
Joost
Thanks. I will try that. But isn't this interesting functionality for C5 to be more flexible? I mean, it's much easier to put php where ever you want...
frz replied on at Permalink Reply
frz
Well, generally we intend the in-context editing to be used by site owners not site developers.

There's an awful lot you can do with custom blocks. There's an awful lot you can do in template files, there's also this concept of a single page you might want to check out.

I could be missing it, but I'm really not clear what anyone would want to stick into a block as straight PHP for that couldn't be solved more flexibly and securely through one of the above methods.

I am deeply concerned about the idea of letting a site owner just cut and paste PHP code around their site willy nilly, and i see this as a potential security hole as well.

One thought that has come up that we're pondering is more of a mail merge feature.. adding something to the concrete5 toolbar in TinyMCE that would let you place dynamic data in the actual content blocks... Like "Hello $username" but on a grander scale.

that's in the back of our minds..
darkorical replied on at Permalink Reply
"Well, generally we intend the in-context editing to be used by site owners not site developers. "

what about those of us who are both?

I am building a web based interface for our existing control software I am currently using Simple Machine Forums + Tiny Portal + custom pages add-on to achieve this the portal system allows for easy navigation from various parts of the system and the blocks work great for displaying information. but I have to be able to access the MSSQL database to do that and that requires straight up PHP code in a content so for me a PHP content block would make Concrete5 the PERFECT CMS for my needs.
SpeedBump replied on at Permalink Reply
SpeedBump
Maybe you should look into creating your own custom blocks to achieve this...
http://www.concrete5.org/help/building_with_concrete5/developers/un...
frz replied on at Permalink Reply
frz
there's actually a block in this thread that will let you embed php i think.

I think this is just a funky way to solve anything but the simplest of problems. I get why you might wanna throw a "current date" in there using php or something like that, but i'm horrified at what will happen when someone who hasn't bothered to understand single pages, blocks, and the rest that c5 has to offer starts messing around with this php block and then can't get the page in or out of edit mode.
darkorical replied on at Permalink Reply
I went ahead and took SpeedBump's advice and made a php block here it is if anyone else wants it or wants to take a look.

~Just a note when entering php do not use open or close tags (<?, <?php, ?>)
darkorical replied on at Permalink Reply 1 Attachment
well something went terribly wrong with that last post so Im trying again to post the block