[英]Adding menu types with custom url parameters to component in Joomla 3
我在將自定義網址參數添加到組件菜單時遇到問題。 我的組件在同一視圖上顯示不同的數據,這取決於通過自定義GET參數傳遞的預定集中的值。 例如,假設這兩個URL是同一視圖的唯一有效變體:
?option=com_mycomponent&view=myview&option=hello
?option=com_mycomponent&view=myview&option=world
如何將這兩個URL作為單獨的菜單類型添加到組件?
您需要以一種這樣的方式更改default.xml文件:創建菜單時,它將要求您提供可選參數。
位於component / your_component / views / yourview / tmpl / default.xml的default.xml文件
該代碼將如下所示
<fields name="request">
<fieldset name="request">
<field name="option" type="hidden"
label=""
required=""
description=""
default="default-value"
/>
</fieldset>
</fields>
作為參考,請檢查components / com_content / views / article / tmpl / default.xml文件
您可以使用外部URL。
創建一個新菜單,然后從菜單項類型>系統鏈接中選擇外部URL。 在“鏈接”字段中添加您的網址。
希望對您有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.