Advertisement:

need help for a modification

Aloittaja Hondo, toukokuu 15, 2014, 07:31:45 AP

« edellinen - seuraava »

Hondo

Hello,
I have written my first modification - but when I want to install it only a few operations of the files are displayed. For Example, in File Calendar.php only 2 of 6 operations are displayed but I don't find the mistake.
Can you please help me?

Andreas

Shambles

<file name="$themedir/Post.template.php">
<operation>
<search position="replace"><![CDATA[ if (!empty($modSettings['cal_allowspan']) || ($context['event']['new'] && $context['is_new_post']))]]></replace>


Notepad++ highlights a discrepancy in your tags ;)

Hondo


Hondo

Another Problem in installDatabase.php of the Mod.
I get the error:
LainaaYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'calendar ADD COLUMN location VARCHAR(60)' at line 1
Datei: /is/htdocs/wp1007012_HAK7TONUQ3/www/forum/Packages/temp/installDatabase.php
Zeile: 31

Here the code of installDatabase.php:
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
  require_once(dirname(__FILE__) . '/SSI.php');
if (version_compare('4', preg_replace('~\-.+?$~', '', min(mysql_get_server_info(), mysql_get_client_info()))) > 0)
$schema_type = ' TYPE=MyISAM';
else
$schema_type = ' ENGINE=MyISAM';

// Category Table
$smcFunc['db_query']('', "CREATE TABLE IF NOT EXISTS {db_prefix}calendar_cat(
id_cat mediumint(8) NOT NULL auto_increment,
cat_order tinyint(4) NOT NULL default '0',
name VARCHAR(255) NOT NULL,
PRIMARY KEY (id_cat)) $schema_type");

// Add location to table calendar
$smcFunc['db_query']('', "Alter TABLE {db_prefix}calendar ADD COLUMN location VARCHAR(60)");


I don't see any mistake.
Please help again.

Andreas

Arantor

I'd suggest using $smcFunc['db_create_table'] (which will not only deal with the 'if not exists' part if you want, it will also safely abstract away the TYPE or ENGINE part of the deal... or even work on PostgreSQL and SQLite if you want to distribute your mod) and $smcFunc['db_add_column'].

In your case, {db_prefix} will not be what you think it is inside an SSI context and thus you cannot use it for schema changing events inside SSI. (In SSI, SMF does not select a database and internally, db_prefix is rewritten to include the database name in there)
Holder of controversial views, all of which my own.


Hondo

works now.
in packages/temp was stored an old version of the files, I deleted it and tried it again.

Hondo

Sorry, need your help again.
My modification runs at the installer but no files are modified. Database installer works correkt.
What the hell is wrong?
Mod ist for SMF 2.x

Thanks Andreas

Hondo


Arantor

I don't see why I should help you if you don't take on board the advice already given. Makes me somewhat against spending any more time trying to help you.
Holder of controversial views, all of which my own.


Hondo

Yes but Table will be created and Modificaiton of Table works.
So there can be no error in installDatabase.php?!
Or what do you mean? Sorry for my bad english.

Advertisement: