6
Quote:
rows:xoops_version.php
$$modversion['name ' ] = _ MI_PRODUCTS_NAME;
$$modversion['version ' ] = 1.00;
$$modversion['description ' ] = _ MI_PRODUCTS_DESC;
$modversion['dirname'] = "products";
rows: modinfo.php
// The name of this module
define("_MI_2SECTIONS_NAME", "products");
// To brief description of this module
define("_MI_2SECTIONS_DESC", "To add Products to the Product Catalogue.");
if you use MI_PRODUCTS_NAME and MI_PRODUCTS_DESC, define them instead than MI_2SECTIONS_ ones who are only an example for a constant name for a 'clone'
Quote:
// Tables created by sql file (without prefix!)
$modversion['tables'][0] = "product";
$modversion['tables'][1] = "products";
This seems to fall over for me cos it wont create the new tables for some reason - I could have manually created them in phpmyAdmin but wasnt sure what the field values where...
go in /modules/sections/sql/mysql.sql: here's the script to build tables neeeded from sections module. If you change it in your new products module, when you 'install' it via XOOPS administration, tables will be automatically created. So instead of 'morphing' sections, try
duplicating the whole directory /modules/sections, change MySQL files according to your new module scope (table name, primary, leave fields as they are at now) and iInstall it: XOOPS will create new tables for you.
Quote:
Do I not also need to edit admin\index.php because it has references in lines to:
function sections() { ////does this need to change?
better to change it ( to clear code) and all its calling in all your files under the /modules/YOURMODULENAME/ structure. Look and replace for "sections()" instead than "sections", otherwise you will get noyt only function but variable and cookie. You should change them too but make it step by step:
Quote:
$result = $xoopsDB->query("select secid, secname, image from ".$xoopsDB->prefix("sections")." order by secname") /////what does this change to?
if you didn't change fields name on mysql.sql file, you don't need to change anything here (at now: but if you decide to create a 'serious' module you should change them in mysql.sql and here too)
Quote:
Will also need to change line to include new module location name:
echo _MD_URLFORTHIS."<br>
<a href=\"".XOOPS_URL."/modules/<b>sections</b>/index.php?op=viewarticle&artid=$artid\">".XOOPS_URL."/modules/sections/index.php?op=viewarticle&artid=$artid</a>
Variables in \language\english\main.php and modinfo.php are easily changed.
It installed ok and worked to point where tried to add product but it didnt list it - the tables didnt create for xoops_product and xoops_products which is i suppose the problem - so I have what I want now but I want the above to work properly so the Products module is seperate from the sections module so if u have any ideas would appreciate it.
surely your problem is due to undefined constants for table names: if you define:
$modversion['tables'][0] = "product";
$modversion['tables'][1] = "products";
then modify mysql.sql changing
CREATE TABLE seccont
to
CREATE TABLE product
and changing
CREATE TABLE sections
to
CREATE TABLE products
Quote:
Sorry for the poor descriptions here....I am exhausted and know bugger all about PHP as you can tell i guess
This is the best way to learn programming: 'unmounting' code is funny exactly like destroying toys when you're children, just to discover how they're built