1
質問:私のコンポーネントのrouter.phpからルートを有効にするにはどうすればいいですか?Joomlaのカスタムプラグインで 'router.php'からのコンポーネントのルートを使用
私は、既定のユーザープロファイルからのルートリダイレクトするカスタムプラグインに取り組んでい:私が持っている私自身のコンポーネントに
index.php?option=com_users&view=profile (SEF: /component/users/profile)
を追加設定
index.php?option=com_mycomponent&view=profile (SEF: /alias/profile)
私のフロント終了プラグイン:
class plgSystemMyPlugin extends JPlugin
{
// constructor
function plgSystemMyPlugin(&$subject, $params) {
parent::__construct($subject, $params);
}
// run after the framework has loaded and the application initialize method has been called
function onAfterInitialise() {
// when component users and view profile are called
if(isset($_GET['option'], $_GET['view'])
&& $_GET['option'] == 'com_users'
&& $_GET['view'] == 'profile')
{
$route = JRoute::_('index.php?option=com_mycomponent&view=profile');
JFactory::getApplication()->redirect($route, null, null, true);
}
}
}
私のコンポーネントでは、すべてのリンクが正しくルーティングされていますYすなわち:?次のようにJROUTEがそれを翻訳プラグインで
index.phpのオプション= com_mycomponent &ビュー=プロフィール=>/別名 /プロフィール
:
インデックス.php?option = com_mycomponent & view = profile =>/component/mycomponent/profile
は使用できません。
- コアは、あなたが選択できるようになります新しいパラメータを追加する必要がありますプラグインのxmlファイルに
- の.htaccess
- Joomlaのリダイレクトプラグイン
おかげで、私はすでにsoultionを発見したにも関わらず、あなたのポストのための非常に。私はこれがうまくいくと確信しているが、複数の言語は、サイト上で使用されていないところ。それを解決するために、私は、 'jos_menu'テーブルから** Itemid **を取得するために、パラメータと現在の言語としてリンクを使用しました – WooDzu