Flow3 a php based framework ,through which web-developers can create excellent web solutions.This blog is about,creating a website in flow3 and how templating can be done with the help of fluid.
Installing FLOW3
Setting up TYPO3 Flow is pretty straight-forward. See below for System requirements.
A web server ( Apache with the mod_rewrite module enabled ) PHP 5.3.2 or > (Check your phpinfo() to know your php version) A database supported by Doctrine DBAL, such as MySQL Command line access
The following command will clone the latest version, include development dependencies and keep git metadata for future use:
php composer.phar create-project --dev --keep-vcs typo3/flow-base-distribution PROJECT_NAME
After that,Kindly give proper perimission for all the files and folders.
./flow core:setfilepermissions username webservername group-name
Above command will give appropriate permission for all folders and files. For further informations kindly run the command ./flow help in terminal.
./flow help
Once the clonning of the website is done , add new virtual host by modifying the httpd-vhost.conf file.
For creating a new extension/Package
flow.bat kickstart:actioncontroller --generate-actions --generate-related Acme.Demo CoffeeBean (In windows)
./flow kickstart:actioncontroller --generate-actions --generate-related Acme.Demo CoffeeBean (In Linux)
Database Setup
Create an empty database and set up a user with sufficient access rights
Copy the file Configuration/Settings.yaml.example to Configuration/Settings.yaml.
Open and adjust the file to your needs – for a common MySQL setup, it would look similar to this:
TYPO3: Flow: persistence: backendOptions: driver : 'pdo_mysql' dbname : 'databasename' # adjust to your database name user : 'username' # adjust to your database user password: 'password' # adjust to your database password host : 'host' # adjust to your database host
After providing all the necessary informations related your database in Settings.yaml file, run ./flow doctrine:migrate in terminal .
./flow doctrine:migrate
Templating for website
For creating a theme/template for a website there is a function in Flow3 called “setLayoutPathAndFilename” that can be triggered in the ”initializeView” function. So we should built a base controller eg: ThemeController and any new controller should extend this newly created base class.
class ThemeController extends \TYPO3\FLOW3\MVC\Controller\ActionController { public function initializeView(\TYPO3\FLOW3\MVC\View\ViewInterface $view) { $view->setLayoutPathAndFilename(“PATH_TO_TEMPLATE”); } } PATH_TO_TEMPLATE it should be the path to an existing template file. Eg ../PKGS/Application/PKG.NAME/Resources/Private/Layouts/file.html And in the newly added Layout file add
class ThemeController extends \TYPO3\FLOW3\MVC\Controller\ActionController { public function initializeView(\TYPO3\FLOW3\MVC\View\ViewInterface $view) { $view->setLayoutPathAndFilename(“PATH_TO_TEMPLATE”); } }
Eg ../PKGS/Application/PKG.NAME/Resources/Private/Layouts/file.html
.
Routing In Flow3 framework
Change the Routes.yaml file add your routes in that file . - name: 'Welcome Screen' // It is not mandatory to add name uriPattern:'index/index' defaults: '@packages': 'TYPO3.Index' '@controller':'coffeebean' '@actoion':'index' '@format':'html'
- name: 'Welcome Screen' // It is not mandatory to add name uriPattern:'index/index' defaults: '@packages': 'TYPO3.Index' '@controller':'coffeebean' '@actoion':'index' '@format':'html'
To set this package as the index package leave uriPattern as empty. The route becomes active if a requests matches the pattern defined by the uriPattern.
For furthur references please vist : http://docs.typo3.org/flow/TYPO3FlowDocumentation/Quickstart/Index.html http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/Index.html
Du musst angemeldet sein, um einen Kommentar abzugeben.