Quantcast
Channel: XOOPS Web Application System :: Forum
Viewing all articles
Browse latest Browse all 82

Re: search, sort, pagination in XOOPS [by irmtfan]

$
0
0
Q and A::search, sort, pagination in XOOPS
You really should start by reading XoopsObject class located in XOOPS255/kernel/object.php
That is the heart of any module to do anything using database include search,sort,order,pagination,...
so you should stop writing these kind of codes:
global $xoopsDB;  
$resultmysql_query("SELECT * FROM ".$xoopsDB->prefix("directory_info")." where name like '%" .  $_POST['search']  .  "%' or unit   like '%" .  $_POST['search']  .  "%' or department like '%" .  $_POST['search']  .  "%'  or position like '%" .  $_POST['search']  .  "%' ORDER BY name");


you should create the sql file for every table and start create a class for that table.
I recommend to see publisher as a very profesional module.
lets start with an example from publisher module.
we want to see how we can write a class for table publisher_categories in sql file.
at first you can see the table fields and structure in sql file:
http://svn.code.sf.net/p/xoops/svn/Xo ... k/publisher/sql/mysql.php
CREATE TABLE `PUBLISHER_categories` (
  `
categoryidint(11NOT NULL auto_increment,
  `
parentidint

Viewing all articles
Browse latest Browse all 82

Trending Articles