我是Joomla編程新手。我已經構建了一個插件,並且運行良好。我只有一點煩惱,整天都讓我發瘋。當你進入後端來配置插件時,選項被偏移180px的左邊距。我發現這是因爲這些選項被封裝在一個帶有應用了該邊距的style =「control-group」的div中。Joomla Plugin後端選項
爲了更好地理解下面是輸出的濃縮版的問題:
<div class="control-group">
<div class="control-label">
<label id="jform_params_group_template_mapping-lbl" for="jform_params_group_template_mapping" class="hasTooltip" title="" data-original-title=""></label>
</div>
<div class="controls">
//This is where my generated code is
<div class="control-group">
<div class="control-label">
<label>Uncategorised</label>
</div>
<div class="controls" style="float:right;margin-right:20%;">
</div>
</div>
<div class="control-group">
<div class="control-label">
<label>Blog</label>
</div>
<div class="controls" style="float:right;margin-right:20%;">
</div>
</div>
<div class="control-group">
<div class="control-label">
<label>TestingTemplate</label>
</div>
<div class="controls" style="float:right;margin-right:20%;">
</div>
</div>
</div>
</div>
正如你看到的,我的控制是所有控制內。我似乎無法找到帶有班級控制組的父級Div來自哪裏。我寧願我的生成的內容是有自己的控制,而不是sub div的。
請讓我知道您需要查看哪些代碼部分以幫助我確定此問題。我覺得它是XML清單的一部分,但是對於Joomla來說是新知道的。
清單文件的配置部分爲:
<config>
<fields name="params">
<fieldset name="basic">
<field type="fta.mapping" name="group_template_mapping" addfieldpath="/plugins/system/assigntemplatebycategory/fields" description="PLG_SYSTEM_TEMPLATE_ASSIGNER_GROUP_TEMPLATE_MAPPING_DESC" label="PLG_SYSTEM_TEMPLATE_ASSIGNER_GROUP_TEMPLATE_MAPPING_LABEL" default=""/>
</fieldset>
</fields>
</config>
它似乎看着http://www.ostraining.com/blog/how-tos/development/getting-started-with-jform/,我不知何故創建了一個字段組,其中包含另一個字段組的字段與我所有的領域在裏面。不知道這是否解釋得更好或更糟。 –
你可以請張貼XML清單?字段中的字段組不是一個好主意 –
我是從另一個開發人員的工作開始的。看來在更多的閱讀之後,有兩種方法,getInput和getLabel在擴展jformfields時使用。以前的開發人員只擴展了getInput,並將子字段和子標籤的HTML作爲getInput的返回值。根據我閱讀的內容,我應該將其重新編碼爲兩個函數,一個用於GetLabels下的標籤,另一個用於getInput下的選項。請讓我知道,如果我正確理解這一點。 –