简体   繁体   English

将标签和字段添加到自定义joomla组件

[英]Add tabs and fields to custom joomla component

How can i add more tabs and fields to a joomla component in backend, 如何在后端的joomla组件中添加更多标签和字段,

-Tried editing the view xml file adding more fieldsets, no success -Tried editing the edit file in view admin component, no success, -尝试编辑添加了更多字段集的视图xml文件,但没有成功-尝试在视图管理组件中编辑该编辑文件,没有成功,

In other words i want to achieve this, just like the image 换句话说,我想实现这一目标,就像图像一样 图片

Any help? 有什么帮助吗?

You have to set it to the view template admin\\views\\*view_name\\tmpl\\*template_name.php . 您必须将其设置为视图模板admin\\views\\*view_name\\tmpl\\*template_name.php

The structure that you have to use is: 您必须使用的结构是:

<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'general')); ?>
    <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'general', JText::_('COM_COMPONENT_NAME_TAB_1_NAME', true)); ?>

    ...

    <?php echo JHtml::_('bootstrap.endTab'); ?>
    <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'advanced', JText::_('COM_COMPONENT_NAME_TAB_2_NAME', true)); ?>

    ...

    <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>

You could also check core components to get more examples. 您还可以检查核心组件以获取更多示例。

As for the contents of each tab, you could restrict the loop to get the fields of one fieldset only using: 至于每个选项卡的内容,您可以使用以下方法限制循环以获取一个字段集的字段:

<?php foreach ($this->form->getFieldset("general") as $field): ?>
    <div class="control-group">
        <div class="control-label"><?php echo $field->label; ?></div>
        <div class="controls"><?php echo $field->input; ?></div>
    </div>
<?php endforeach; ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM