Re: Contao 3 for extentions
Hi, think info is only in German. Saw a lot of talk on the German website, but my German is really bad
Re: Contao 3 for extentions
There are lots of differences. Most of the file system is completely overhauled, so if you try to install an extension from 2.9, it will fail.
Also, I'd love to see how the ER can be made to prevent installation of an extension that is unsupported, e.g. if you write a 3.0 extension, then you cannot install it on 2.x at all.
Re: Contao 3 for extensions
Versioning should become better, also with themes. But I don't think Contao 3 has anything like that.
Re: Contao 3 for extensions
Actually, V2 extensions can be used in V3 with a minor adjustment – you have to register all files by yourself. However, the newly included devtools extension will generate the registration file for you. V3 extensions using the V2-style (so the only difference to an "old" extension is the new autoloader.php for V3 compatibility) should work in V2, too. Of course, V3 extensions using the new features will not run on V2 (I guess the ER will not allow downward installations).
Re: Contao 3 for extensions
Most extensions won't work. As soon as they use images or files then afaik the extension won't work. And I also wonder about GET and POST info and some other objects that are used in a static sense. Perhaps you know what happens in those cases?
Modules for Contao 3 - the database based file system
Contao 3 stores no longer file paths + filename, eg in singleSRC field, but a number
( is the path + filename now centralized in another table)
Also when updating Contao 2 to 3, the updater has a method updateFileTreeFields for all types FileTree in DCA.
When updating all be converted with the type fileTree in DCA.
In my banner module that is, in the back end I choose a picture, after saving is not a path, but a number in the field banner_image.
When viewing the frontend, (in the back end DCA output) or callback back end module must now be converted the number to path and file name.
Here is an excerpt how to do this.
Code:
// in singleSRC is now a number
// Check for version 3 format
if (!is_numeric($this->singleSRC))
{
return '<p class="error">'.$GLOBALS['TL_LANG']['ERR']['version2format'].'</p>';
}
$objFile = \FilesModel::findByPk($this->singleSRC);
in $objFile->path is now the searched content path and file name.
Modules for Contao 3 - new static classes
Some classes are now static.
This can generate a message (class Input) in Contao 3:
Quote:
Fatal error: Call to a member function post () on a non-object
Now there are 2 variants for the solution.
Contao 2 compatible:
Using $this->import(...);
Example for input:
Old:
Code:
$this->Input->post (...);
New:
Code:
$this->import('Input');
$this->Input->post(...);
For Contao 3 and with namespace usage (and thus functionally only there) to change the input line as follows:
Other examples:
Code:
$this->Environment->httpUserAgent
//change in
\Environment::get('httpUserAgent')
$this->Environment->remoteAddr
//change in
\Environment::get('remoteAddr')
$this->Environment->ip
//change in
\Environment::get('ip')
$this->Environment->request
//change in
\Environment::get('request')
Re: Contao 3 for extensions
Hi to all,
I just found out that their is a chrome extension available for Conato 3:
http://contao.org/de/news/contao-tools-fuer-chrome.html
I am dissapointed that not all news is available in the English part of the website. At least all announcements should be made available in English.
I also found this information about contao 3:
http://contao.org/de/news/update-auf-contao-3.html
http://contao.org/de/news/den-layout-bu ... ieren.html
which i am still trying to translate
Rgds,
Frederick
Re: Contao 3 for extensions
I'm going to release my updated website for 3.x, so I'm having to slowly change the extensions I regularly use to 3.x compatibility.
The changes I've had to make aren't too bad. Here's what I've picked up:
- your config.php file should remain unchanged (I believe)[/*:m:1tgmwdxf]
- move your Classes like News.php into a classes/ folder[/*:m:1tgmwdxf]
- move your Modules like ModuleNews.php into a modules/ folder[/*:m:1tgmwdxf]
- move your Content Elements like ContentImage.php into a elements/ folder[/*:m:1tgmwdxf]
- move your public content like icons, css into a assets/ folder and add the new .htaccess file for that (copy one from news)[/*:m:1tgmwdxf]
- other types have to be moved to folders: widgets/, pages/, forms/ [/*:m:1tgmwdxf]
- move all your sql statements from the database.sql file and attach them to each DCA field using 'sql' => "int(10) unsigned NOT NULL default '0'"; remember to use double quotes here for easy conversion. You also have to create "internal-only" (dud) DCA field now for fields that ONLY appeared as database entries, e.g. id, pid, tstamp[/*:m:1tgmwdxf]
- Add primary keys into your DCA too in the DCA 'config' section 'sql' => array('keys' => array('id' =>'primary', 'pid' => 'index', 'ptable' => 'index'))[/*:m:1tgmwdxf]
- Add the Contao Namespace too all your PHP classes, modules, elements, etc. and derive your classes using \ClassName[/*:m:1tgmwdxf]
- Now you can modify your code to use the static classes for \Input and other modifications to make the modules compatible[/*:m:1tgmwdxf]
- If you are using additional Models, you'll have to create (or copy and modify) model files which query the database and replace your database calls with model function calls. Follow the convention used in News, Calendar as they have some useful functions for queries.[/*:m:1tgmwdxf]
- You can no longer use the \Database class in the Frontend class, so any modules you write, or HOOKS that are in \Frontend mode, must be rewritten using \Model queries, which return database results and your existing code and use that seamlessly. You can just replace the DB query with a Model Query, and if you don't have that Model, write it yourself, e.g. \MyModel->findById($intId).[/*:m:1tgmwdxf]
- At this point you can now run the autoloader App in the BE Developer section, to automatically create the autoloader ini and php files.[/*:m:1tgmwdxf]
- Know that now tl_content has a ptable and can therefore be used by any extension to add content elements to an entry. News and Events now use the Content Builder for their default story modes. This is stunning, a feature we've been asking for since we all got on board TL.[/*:m:1tgmwdxf]
Re: Contao 3 for extensions
Hi,
Quote:
Originally Posted by thyon
- move all your sql statements from the database.sql file and attach them to each DCA field using 'sql' => "int(10) unsigned NOT NULL default '0'"; remember to use double quotes here for easy conversion. You also have to create "dud" DCA field now for fields that used to ONLY have database entries, e.g. id, pid, tstamp[/*:m:th413p25]
Where can I find an example of "dud" DCA field?
Best regards.
Re: Contao 3 for extensions
You can use "news" as an example. It has keys and internal (non-visible DCA) fields.
Re: Contao 3 for extensions
Thanks.
It looks like I found the answer; there SQL table might have items which wouldn't appear in its edit view.
Re: Contao 3 for extensions
Quote:
Originally Posted by thyon
The changes I've had to make aren't too bad. Here's what I've picked up:
- ...
- move your public content like icons, css into a assets/ folder and add the new .htaccess file for that (copy one from news)[/*:m:f3rfty9g]
If someone want to keep old style directories, such as html/, please keep in mind to add .htaccess file to allow access those resouce files.
Some extensions lost displaying icon of backend's menu in left column.
Best regards.
Re: Contao 3 for extensions
Hi THyon,
About this part:
move all your sql statements from the database.sql file and attach them to each DCA field using 'sql' => "int(10) unsigned NOT NULL default '0'"; remember to use double quotes here for easy conversion. You also have to create "internal-only" (dud) DCA field now for fields that ONLY appeared as database entries, e.g. id, pid, tstamp
Add primary keys into your DCA too in the DCA 'config' section 'sql' => array('keys' => array('id' =>'primary', 'pid' => 'index', 'ptable' => 'index'))
DO I need to do something special to have the sql generated. When going to the install tool, I don't see any query to be updated when creating a new module.
thx
Re: Contao 3 for extensions
Disable the DCA cache during development. I've done this a few times now and that's all you need to do, otherwise your syntax is wrong, look at the news extension to see how to do it, that's how I figured this all out.