Convert PHP file for use in Smarty template
Jamroom Developers
There is already a module that posts to twitter, its called OneAll
Modules: OneAll
https://www.jamroom.net/the-jamroom-network/networkmarket/47/oneall-social
If you wanted to turn your existing php file into a jamroom module then you can do it that way too.
Yes, everything in jamroom is a module.
The most basic module has a directory, a changelog.txt an include.php and in your case, if you want it to control a URL then it needs an index.php
Example
* call your module xxPost and place it in /modules/xxPost/
/modules/xxPost/changelog.txt
/modules/xxPost/include.php
/modules/xxPost/index.php
/modules/xxPost/changelog.txt
Changelog for Post to Twitter module
Version 1.0.0
- Initial Release
/modules/xxPost/include.php
<?php
defined('APP_DIR') or exit();
function xxPost_meta(){
$_tmp = array(
'name' => 'Post to Twitter',
'url' => 'post',
'version' => '1.0.0',
'developer' => 'Sombody Somwhere, ©' . strftime('%Y'),
'description' => 'Somthing about your module here',
'category' => 'custom'
);
return $_tmp;
}
function xxPost_init(){
return true;
}
That will get your module appearing in the ACP. If you cant see it run the INTEGRITY CHECK. Then go to the INFO tab of the module and check the checkbox to activate it.
Next make it do something
/modules/xxPost/index.php
<?php
defined('APP_DIR') or exit();
function view_xxPost_message($_post, $_user, $_conf)
{
return 'all the processing has completed';
or to return to a different location:
jrCore_location("{$_conf['jrCore_base_url']}/somewhere/you/want/to/redirect/to");
}
Docs: "Freelancers Read this"
https://www.jamroom.net/the-jamroom-network/documentation/module-developer-guide/3513/freelance-developers-read-this
updated by @michael: 05/17/18 02:24:21AM