我正在開發一個組件,我想檢索項目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 1.5到Joomla 2.5的組件
- 4. 組件從Joomla 2.5到Joomla 3.0
- 5. K2 Joomla 2.5中的項目分頁符?
- 6. Joomla 2.5添加選項組到文章
- 7. 文件輸入的Joomla 2.5組件
- 8. 如何從joomla 2.5數據庫中選擇數組組件2.5
- 9. 如何創建joomla 2.5組件?
- 10. 覆蓋組件/ com_users/models/forms/login.xml - Joomla 2.5?
- 11. 使用joomla 2.5用戶組件
- 12. Joomla 2.5 - 組件開發 - 使用表格
- 13. Joomla 2.5 ajax文件上傳
- 14. Joomla 2.5內容插件
- 15. 從外部腳本訪問Joomla 2.5以獲得文章編號
- 16. Joomla 2.5分頁
- 17. Joomla 2.5數據檢索在外部的PHP頁面
- 18. Joomla 2.5檢索用戶的新註冊ID
- 19. 調整前端編輯窗口joomla 2.5
- 20. Joomla!2.5 ACL不顯示選項
- 21. 如何檢查選定項目在組合框中的編號?
- 22. 如何在joomla中的項目中添加mutilple類別2.5
- 23. Joomla 2.5 - JUser不返回用戶組名
- 24. 的Joomla組件搜索
- 25. 錯誤的Joomla 2.5
- 26. Joomla 2.5 Web服務
- 27. 多語言joomla 2.5
- 28. 從組合框中檢索項目
- 29. 按鍵值檢索數組項目
- 30. 檢索JList項目的數組數據
感謝所有,$ ID = JRequest :: getInt( '身份證');正在Joomla 2.5工作 – Abhinav 2012-08-06 13:09:34