我在Joomla有一个注册页面。我使用BreezingForms扩展进行注册。一切正常。
现在我想包含我的自定义PHP代码,并在表单提交上调用一个方法。有什么建议吗?有一个扩展Jumi来包含代码片段。但是我如何在表单提交上调用特定的方法并继续现有的formsubmit操作(保存在DB中)。
<?php
function WriteContent()
{
//My Code
}
?>
我想在formsubmit上调用WriteContent。
下面是Joomla的详细信息
安装环境:Linux
PHP Version 5.3.18
Joomla !版本Joomla !2.5.8稳定
Joomla Platform 11.4.0
我一直在这样做基本上我粘贴php代码在结束提交文本区域
这是一个简单而复杂的代码,我使用一个网站来重定向基于k2额外字段的表单发布。表单包含对joomla框架的调用。让我知道你可能需要什么,并会为你构建一个自定义代码。希望这是一个好的方向。
require_once("configuration.php");
$conf = new Jconfig ();
$base_url = JURI::root();
$this->execPieceByName('ff_InitLib');
if(isset($_REQUEST['id'])){
$state = JRequest::getVar('state');
$id = JRequest::getVar('id');
// Fetch k2 items extra fields
$f_rows = ff_select("SELECT `extra_fields` FROM `".$conf->dbprefix."k2_items` WHERE `id` =".$id);
$mfields = $f_rows[0];
$dfields = $mfields->extra_fields;
$fields =(array)json_decode($dfields,true);
//Blind Method comented assumed item 2 thus in array position 1 is always the redirection link
if (isset($fields[1])) {
$link = @$fields[1]['value'];
}
$link = addhttp($link);
if (url_exists($link)) {JFactory::getApplication()->redirect($link);}
}// end if isset else go to page 2
//header("location: /index.php?option=com_virtuemart&page=shop.cart");
function addhttp($url) {
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
$url = "http://" . $url;
}
return $url;
}
function url_exists($url) {
if (!$fp = curl_init($url)) return false;
return true;
}