我在Joomla有一个注册页面。我使用BreezingForms扩展进行注册。一切都很好。
现在,
我想包含我的自定义PHP代码,并在表单提交时调用一个方法。对如何做有什么建议吗?有一个包含代码片段的扩展Jumi。但是如何在表单提交上调用特定的方法并继续现有的表单提交操作(保存在DB中)。
<?php function WriteContent() { //My Code } ?>
我想在formsubmit上调用WriteContent。
以下是Joomla的详细信息
构建于: Linux
PHP版本5.3.18
乔姆拉!版本Joomla!2.5.8稳定
Joomla平台11.4.0
发布于 2013-08-14 21:34:08
我一直在这么做,基本上我把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;
}https://stackoverflow.com/questions/17061848
复制相似问题