duannao1920 2013-08-22 01:32
浏览 37
已采纳

创建joomla模块以执行简单查询并显示结果

Besides the tables of joomla, I create my own table in the same database joomla!

Now I wanted to create a module, which made ​​the selection of this table and show. How can I do this!

Table FRUITS

ID | NAME
1 | apple
2 | orange
3 | banana

I have already created the structure of the module! Now I lack the build file:

  • helper.php
  • tmpl / default.php
  • 写回答

2条回答 默认 最新

  • duanpiyao2734 2013-08-22 03:12
    关注

    Try this,

    Inside your helper.php

    function GetDetails(){
      $db = JFactory::getDBO();
      $sql= "SELECT * FROM FRUITS";
      $db->setQuery($sql);
      $db->query();
      $res = $db->loadAssocList();
      return $res;
    }
    

    and in your mod_ file have call to this function like

    $result = class_name :: GetDetails();
    //$result is available in your default.php
    

    For more about module development in joomla.

    Hopes its help you..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制