Results 1 to 6 of 6

Thread: Developing my first module

  1. #1
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Developing my first module

    Hi,

    I'm learning how to develop a module for Contao but i'm running into a few issues, i wonder if anyone on here could help me solve them?

    I am using the tutorial 'Cd Collections', which can be found here:http://dev.contao.org/projects/typol...rialsExtension.

    The first issue I am having is that Contao will not automatically update my database from the database.sql file in the config folder. I had to do it manually and now when I 'update database' within Contao it asks to drop the table. It seems for some reason it does not recognize the SQL file.

    The second issue is that when I go into the extension manager the CD Collections module is not listed. I have tried running the install tool but i cannot seem to get the module to show.

    Finally (this may be related to the second issue) the CD Collection module DOES show on the content menu within the Contao admin area, but when I click it i get an internal server error. The link looks right 'http://localhost/contao-test/contao/...=cd_collection', but I can't get the backend to work.

    I have followed each step of the tutorial closely, but cannot get this to work. If anyone could guide me in the right direction i would greatly appreciate it. If you need anymore information just ask!

    Thanks!

  2. #2
    User
    Join Date
    07-26-09.
    Posts
    175

    Default Re: Developing my first module

    Hey punkstjimmy

    You may wanna take a look at the more recent version of the tutorial, can be found here - http://blog.qzminski.com/2010/09/cre...dule-part-one/. Soon I will publish another one, more detailed and with higher quality of the code.

    The first issue may occur because your table name does not start with "tl_" prefix. Also, there may be some incorrect syntax there (like missing space or something).

    Second issue - I am not sure about this, but it probably happens because your extension is not present in the official repository.

    Third issue - internal server error? Very strange, are you sure you haven't made any mistake in the code?

  3. #3
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Re: Developing my first module

    Thanks for the reply, that tutorial looks a lot clearer!

    I've managed to get the module working, but i'm still having the database and extension manager issues.

    The SQL syntax looks ok to me (i just double checked it against the code in the link you gave me) and I am using the tl_ prefix. This is the exact code i'm using:

    Code:
    -- 
    -- Table 'tl_cds'
    --
    CREATE TABLE 'tl_cds' (
    'id' int(10) unsigned NOT NULL auto_increment,
    'tstamp' int(10) unsigned NOT NULL default '0',
    'title' varchar(64) NOT NULL default ' ',
    'artist' varchar(64) NOT NULL default ' ',
    'image' varchar(64) NOT NULL default ' ',
    'comment' text NULL,
    PRIMARY KEY  ('id')
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    It's still asking me to drop the tables when I update the database, even though they are being used by the module.

    How does contao check which tables are needed by the installed extensions? Does it compare the database with each module's 'database.sql'? Or does it use a different file to determine which modules are using which tables?

  4. #4
    User
    Join Date
    04-10-11.
    Posts
    162

    Default Re: Developing my first module

    Just fixed it, I was using ' ' instead of ``. I didn't realise this would make a difference!

    Thanks again for the updated tutorial!

  5. #5
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Developing my first module

    2nd issue -- an extension won't show unless it is installed from the repository, because the manager is database-driven itself.
    Brian

  6. #6
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Developing my first module

    A couple of things to help with the third issue.
    Run the system-check tool and make sure you're all "green".
    In Settings::Security Settings you can enable "Display error messages" and "Enable debug mode" to see more clearly whats going on/wrong.
    Read http://www.contao.org/developers-guide.html (i'm sure you have)
    Read this little hidden gem (a litte outdated, but still relevant) http://st1.contao.org/tl_files/meeti...POlight-en.pdf

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •