Where to put php require once

Permalink
I have a php restaurant menu script I purchased. I installed it in a folder in my root directory. Concrete is also installed in the root directory. I installed the script and it says I need to put <? require_once("user_function.php"); ?> in my php file. I tried putting that in my head includes and got an error. Does anyone know what file i put this include in?

 
JohntheFish replied on at Permalink Reply
JohntheFish
Before jumping in to the details, how familiar are you with php programming and Concrete5 programming?

Do you want the script you have acquired to show in one page only, or on multiple pages, or on every page of your site?

What you are trying to do is possible, but not as simple as your script suggests and will involve either creating a single page or a block.
subdeli replied on at Permalink Reply
I know barely enough php to get by. I'm a front end guy. And it only has to show up on one page.
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
The good news is that incorporating the menu php into just one page easier than the other possibilities.

What you need to read up on in the developer info and howtos is 'single pages'. There is also a section on single pages in Remo's Concrete5 book.

What you should be aiming at is to build the menu php script into a single page, which may involve splitting it up into a view part and a controller part.
subdeli replied on at Permalink Reply
I installed the script to the single pages directory. I just put in the page the require once, then the code that outputs the menu. I keep getting an error Fatal error: Call to a member function get_by_id() on a non-object in /home1/subdelic/public_html/single_pages/menu/user_function.php on line 213 . I don't know if thats an error with concrete or with my script.
JohntheFish replied on at Permalink Reply
JohntheFish
Its not a case of installing the menu php.

You need to write code for a single page that then presents your menu php.

Hence my notes that you need to read up on how to design/write single pages.

Unless it is actually coded as a Concrete5 single page, it will not work and you will get errors.
subdeli replied on at Permalink Reply
I just ended up installing my script as normal, and putting an iframe in my single page. But does just normal php not work in a single page? Before I just put 2 lines of code in the single page that called function. Thats when I got the errors and when I went to the actual php file it worked fine. Thanks for all the help though.