我正在開發一個組件,我想檢索項目ID並使用該ID,以便每次頁面加載該項目ID將用於其他事情。 感謝檢索Joomla 2.5組件項目編號
0
A
回答
1
要檢索組件項目的ID,你需要做幾件事情:
使用創建鏈接到項目它的ID例如
$mylink = 'index.php?option=com_yourcomponent&view=myitemview&id=99'
你應該再通過該鏈接通過JRoute
櫃面用戶已啓用SEF:
$myRoutedLink = JRoute::_($myLink);
這可確保當你建立你的項目頁面時,試圖訪問該ID是可用的。對於Joomla! 2.5您應該使用JInput來檢索變量,因爲JRequest已被折舊並從J1.7開始被替換。
第一步是獲得Joomla!實例,然後在檢索變量之前輸入對象,例如
// Get Joomla! instance
$jAp = JFactory::getApplication();
$jInput = $jAp->input;
現在,我們可以得到你的變量:
// Get variables
$passedID = $jInput->get('id',0) // Where the 0 is the default if 'ID' doesn't exist.
$passedInt = $jInput->getInt('myInt',0) // You can also get JInput to give the right type back
0
我知道關於Joomla 1.5.xx
,我已經習慣了得到的itemid從網址爲:
$itemid = JRequest::getVar('itemid');
希望這將有助於你還。按照鏈接以獲得更多信息JRequest
相關問題
- 1. joomla組件下的組菜單項2.5
- 2. 的Joomla 2.5組件
- 3. Joomla 2.5組件更新
- 4. Joomla 2.5的組件分頁
- 5. Joomla 2.5組件實現
- 6. 從Joomla 1.5到Joomla 2.5的組件
- 7. 組件從Joomla 2.5到Joomla 3.0
- 8. K2 Joomla 2.5中的項目分頁符?
- 9. Joomla 2.5添加選項組到文章
- 10. 檢索字典項編號
- 11. 文件輸入的Joomla 2.5組件
- 12. 如何從joomla 2.5數據庫中選擇數組組件2.5
- 13. Joomla 2.5+語言文件編輯器
- 14. json在joomla 2.5組件調用
- 15. 組件joomla 2.5與數據庫訪問
- 16. 使用joomla 2.5用戶組件
- 17. 用php組件創建Joomla 2.5用戶
- 18. 覆蓋組件/ com_users/models/forms/login.xml - Joomla 2.5?
- 19. Joomla 2.5渲染com_content組件輸出
- 20. Joomla 2.5 - 組件開發 - 使用表格
- 21. 的Joomla 2.5 - 組件致命錯誤
- 22. 如何手動卸載joomla組件2.5
- 23. Joomla 2.5 SEO/htaccess停止組件偵測
- 24. 擴展Joomla 2.5橫幅組件
- 25. 如何創建joomla 2.5組件?
- 26. Joomla 2.5變量全局組件範圍
- 27. joomla 2.5修改後端組件
- 28. 的Joomla 2.5組分形成
- 29. joomla 2.5自定義組件的智能搜索(finder)?
- 30. 如何在joomla 2.5中創建joomla用戶組2.5
感謝所有,$ ID = JRequest :: getInt( '身份證');正在Joomla 2.5工作 – Abhinav 2012-08-06 13:09:34