1
pulapol
How to make a module renameable and cloneable ?
  • 2010/2/19 14:40

  • pulapol

  • Just popping in

  • Posts: 55

  • Since: 2008/4/6 1


Hi...

i'm trying to make a simple seo content module for my website

i'm a php beginner...trying to learn make module by looking at other module to follow as a guide..so far so good..but sadly my coding is not following the standards...have more to learn

ok one of the thing that i want to do in my module is to make my module renameable and cloneable

...i saw this code in trabis dummy module - xoops_version.php
which can make our module folder renameable ..i had incorporated in my module
$modversion['dirname'] = basename(dirname(__FILE__));
$modversion['name'] = ucfirst(basename(dirname(__FILE__)));

what about the database table ? MySQL query ?

how do i do it

as example how do i change tthe code below so it can be renameable and clone multiple times...?


CREATE TABLE `mycontent_details` (
  `
id` int(10) unsigned NOT NULL auto_increment,
  `
filename` varchar(200) default NULL,
  `
metakeywords` mediumtext,
    `
metadescription` mediumtext,
    `
pagetitle` mediumtext,
    `
doctitle` mediumtext,
    `
content` mediumtext,
  
PRIMARY KEY  (`id`)
) 
ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

global $xoopsDB; 
mysql_query("DELETE from ".$xoopsDB->prefix("mycontent_details")." where id='" . $_GET['del'] . "'");



what else should i look into beside above..im a php beginnner..help..


p/s : sorry for my ppor english and please ignore the wrong fieldtype and value

2
ghia
Re: How to make a module renameable and cloneable ?
  • 2010/2/19 15:36

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


The clone module can propose a clone function, which has to copy mysql.sql to clonename.sql changing the tablenames to clonename_tablename.
This file will be used to generate the tables in the database.
I believe eg Ghost 2.0 has such function, altough it mingles the language for an obscure reason in the SQL naming.
In xoops_version is also a pointer to the right sql file.

3
pulapol
Re: How to make a module renameable and cloneable ?
  • 2010/2/19 17:23

  • pulapol

  • Just popping in

  • Posts: 55

  • Since: 2008/4/6 1



where can i download it ?

4
pulapol
Re: How to make a module renameable and cloneable ?
  • 2010/2/21 9:26

  • pulapol

  • Just popping in

  • Posts: 55

  • Since: 2008/4/6 1


Here's a good read...


http://xoops.peak.ne.jp/md/d3forum/index.php?post_id=1500


still trying to understand it