Stand-alone script

Permalink
I have added a "news" facility to my C5 install which stores content in a table of my own in the C5 database. I now need to build an RSS feed from these stories, for which I need a completely stand-alone script that does not include any template or style stuff at all.

I looked in dispatcher.php and copied some of the stuff at the top of that, but I get errors when I try to make a database query.

define('C5_EXECUTE', true);
## Startup check ##   
require('../concrete/startup/config_check.php');
## Load the base config file ##
require('../concrete/config/base.php');
## First we ensure that dispatcher is not being called directly
require('../concrete/startup/file_access_check.php');
## Check host for redirection ##   
require('../concrete/startup/url_check.php');
## Load the database ##
Loader::database();
$db = Loader::db();


Note that I also tried this approach via the "single pages" feature, that that too brings in template stuff.

hockeyshooter
 
ryan replied on at Permalink Reply
ryan
So, if you place a page in the tools director concrete5 will automatically load all the goodies you need.

page:
[site root]/tools/test.php

code:
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
echo BASE_URL;
?>


and reference the page with:
<?php echo View::url('/tools/test') ?>

pull it up in your browser:
/index.php/tools/test

make sure you leave the .php off the end when you're pulling it up in the browser..
hockeyshooter replied on at Permalink Reply
hockeyshooter
That's great - works - no problems, no need to include anything. No issues with permissions either. So I now have an RSS2 feed of my news stories:

http://www.stellarnet.eu/tools/rss...

This method really needs going in the developers' FAQ!