Scripts

Permalink
Hello,

I'm new to concrete5 and was wondering where the best place to store PHP scripts is within the folder structure?

For example, I have a piece of code used for mailing form data that just processes information and creates notifications. The only thing I've figured out so far are the Single Pages, but I don't actually need a "page", only a place to store some small scripts and have the ability to access them. The scripts should have access to the database too.

Any guidance would be appreciated.

Adam

 
argvader replied on at Permalink Reply
argvader
The three directories listed in my title are for 'utility' scripts. There is some fuzziness when something is a library, a helper, or a tool.

I found this document which has a good explanation:

http://c5mix.com/tutorials/beginners-guide-to-concrete5...
andrew replied on at Permalink Reply
andrew
Tools/ generally gets items that, while they need access to c5 (or the c5 database) in some way, don't need to be actual pages.

Say you saved it at "tools/process_mail.php"

You'd then access it using

<?php
$uh = Loader::helper('concrete/urls');
print '<a href="' . $uh->getToolsURL('process_mail') . '">Click here.</a>
?>


you can get the ADODB database object from within the tool as well, by just calling "<?php $db = Loader::db(); ?>
jgarcia replied on at Permalink Reply
jgarcia
will the getToolsURL function work as part of a package as well? if not, how can i include some "tools" type scripts as part of a package?
jgarcia replied on at Permalink Reply
jgarcia
in case anyone else is wondering about this, the getToolsURL function accepts a second parameter, which is the package handle.

<?php
getToolsURL('toolName', 'packageHandle');
?>