Migrating site to C5
Permalink
I have a website that I am converting over to C5. The old site has some custom php that has a pretty detailed form at:
/og.php
which posts to:
/og2.php
both files have a require_once to:
/inc/og_lib.php
which contains the php functions(not mvc) to make the feature work. There is database interaction in the feature.
Should I just create single pages and use a separate db? If so, do I need to add og.php, og2.php & og_lib.php to the dashboard?
Is it better to somehow use the c5 db? What is the best way to make this work in c5?
Please provide me with some specifics as I am still trying to sort out when I need a block/single page, or other. I am new to object oriented programming and mvc, usually just use old school functions, so any help is appreciated.
Thanks for help!
/og.php
which posts to:
/og2.php
both files have a require_once to:
/inc/og_lib.php
which contains the php functions(not mvc) to make the feature work. There is database interaction in the feature.
Should I just create single pages and use a separate db? If so, do I need to add og.php, og2.php & og_lib.php to the dashboard?
Is it better to somehow use the c5 db? What is the best way to make this work in c5?
Please provide me with some specifics as I am still trying to sort out when I need a block/single page, or other. I am new to object oriented programming and mvc, usually just use old school functions, so any help is appreciated.
Thanks for help!
look at External Forms (basically what that is)
I think the quickest and easiest solution is to put those 2 files into single_pages, include your og_lib.php file, and maintain the separate database. This has the benefit of not really requiring any work on your part, BUT now you have 2 databases to maintain.
If you don't want 2 databases, you could add all of the tables from the old database into the concrete5 database and change the code in og_lib.php to reference the concrete5 database instead.
For a heavily-customized form I don't see any reason to do any more integration than that. The only exception being if you needed this form to be a "block" that users could add to any page in your site -- but note that this will require a *LOT* of work, so make sure it's really worth it (I'm guessing probably not).
Hope that helps.
-Jordan
If you don't want 2 databases, you could add all of the tables from the old database into the concrete5 database and change the code in og_lib.php to reference the concrete5 database instead.
For a heavily-customized form I don't see any reason to do any more integration than that. The only exception being if you needed this form to be a "block" that users could add to any page in your site -- but note that this will require a *LOT* of work, so make sure it's really worth it (I'm guessing probably not).
Hope that helps.
-Jordan
Sounds good, where is the best place to put the lib.php file for inclusion?
Doesn't really matter -- might as well put it in your site's top-level /libraries/ directory. Then you can include it with:
(note that the DIR_BASE constant is defined by concrete5, so it will work if you're using it from your single_page controller, but not if it's just a free-standing script file).
DIR_BASE.'/libraries/og_lib.php';
(note that the DIR_BASE constant is defined by concrete5, so it will work if you're using it from your single_page controller, but not if it's just a free-standing script file).
I have gone with the /libraries/ directory and that works great. Now I have a .js file and some images that the single_pages will use. Where should these go and how should they be called by the single_pages?
How about "js/" and "images/"? :)
If you're including them server-side (so you need a URL as opposed to a file path), use DIR_REL instead of DIR_BASE:
although note that if you're including the image from a CSS file, the DIR_REL thing won't work -- you'd need to use a relative path from wherever the css file, which should probably go in "css/", then it would be url(../images/myimage.jpg);
If you're including them server-side (so you need a URL as opposed to a file path), use DIR_REL instead of DIR_BASE:
DIR_REL . '/js/myfile.js'; DIR_REL . '/images/myimage.jpg';
although note that if you're including the image from a CSS file, the DIR_REL thing won't work -- you'd need to use a relative path from wherever the css file, which should probably go in "css/", then it would be url(../images/myimage.jpg);