Форуми / Cotonti / General / Cotonti Connect?

to use cotonti outside of xtemplate

zboy812
#1 20.06.2011 17:17

I want to use a PHP page outside of Cotonti. But i want to get user details from cotonti!

here is my page.php:

<html>

<? include 'cotonti_connect.php'; //is it possible? ?>

<? echo '$user_name'; ?>

</html>

Is this possible? How can i keep the user logged in on my external page?

The reason is, i want to use sed_light for website, but i dont want to use xtemplate for external program.

Thank you for your assitance!!!

 

GHengeveld
#2 21.06.2011 00:37

Sure, try this:

<?php
define('COT_CODE', TRUE);
require_once './datas/config.php';
require_once $cfg['system_dir'] . '/functions.php';
require_once $cfg['system_dir'] . '/common.php';
?>
<html>
<?=$usr['name']?>
</html>

Common.php is where the magic happens. It handles user authentication so you stay logged in.

Actually, this is the way modules work. They have their own file in the root and use this code to load the framework. However in order for it to show up as a module it needs it's own folder in /modules and a setup file.

zboy812
#3 22.06.2011 22:40

So awesome! I will try it tonight and get back you, this is a life saver for what im make. Thanks a lot!

Added 6 days later:

Its working awesome!


Відредаговано: zboy812 (29.06.2011 04:55, 12 років тому)