How to put php in a single page.

Permalink
I have a directory of groups on a mysql database and I have a php script that I use to deliver html string to the screen. I copy the source and put this into an HTML block. This is a pain. I would like to be able to write this source to a file and then use a include on the specific page to get it displayed. I don't want to run the directory scripts on every page call. Just a file include.

I found where another poster asked about a similar thing and a response was to put the php in the template or block. It was also said not to put php through the front end. So, How do I do this?

Do I go and put php in a block somewhere?, or do I put it in a template? If in a template, how do I specify that the php is just for a specific page?

Thanks

 
mkly replied on at Permalink Best Answer Reply
mkly
If this is something you are going to be placing in several areas I would create a new block. It is fairly simple to do.

You can download this basic example.

http://www.concrete5.org/files/7212/9710/3658/basic_test2011.zip...

I don't know how used to concrete5 blocks are but you might want to do a quick read of the documentation here.

http://www.concrete5.org/documentation/developers/blocks/overview/...

On a side note db.xml is required even if you aren't going to use it and it _must_ have two fields. I usually create a dummy field as the second field if I don't need one.

<field name="dummy" type="I"></field>


You could also use @jordanlev's excellent designer content addon to create a block scaffolding instead.

http://www.concrete5.org/marketplace/addons/designer-content/...
nakins replied on at Permalink Reply
Thanks, I'll look into this when I get off work.
mkly replied on at Permalink Reply
mkly
Cool. Feel free to post back here if you run into any issues. There are a few gotchas in there, but once you get through it once it really is refreshingly simple.
nakins replied on at Permalink Reply
Hello again,

I have to simple questions. Please forgive my ignorance here. I once made a change to a droopall install an lost it. So, I what to be clear before I go screwing things up. First, Looking at these block files, I assume that the block files together become a mechanism which allows one to insert the desired code, php, html, whatever, into the database and give it a name and address. These block files in and of themselves do not execute the desire functionality. They are just a means of handling the insertion of and calling of that function providing code into and on the system? Correct?

Second question, is that coffee in those cups?