tdCorePlugin
0.2.4beta
for sf 1.4sf 1.3 and Doctrine
MIT
The tdVisitorCounterPlugin is a symfony plugin that provides basic functionalities enabling TD CMF, such as common configuration or random data generation.
This plugin is a part of TD CMF and is based on Doctrine ORM.
Developers
| Name |
Status |
Email |
Tomasz Ducin |
lead |
moc.liamg <<ta>> nicud.zsamot
|
License
Copyright (c) 2009-2010 Tomasz Ducin
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
table of contents
The tdCorePlugin is a symfony plugin that provides basic functionalities
enabling TD CMF, such as common configuration or random data generation.
This plugin is a part of TD CMF and is based on Doctrine ORM.
Install the plugin via the subversion repository by executing the following
command from the project root directory:
$ svn co http://svn.symfony-project.com/plugins/tdCorePlugin/trunk plugins/tdCorePlugin
or by using the default symfony plugin install command:
$ ./symfony plugin:install -s beta tdCorePlugin
as the actual release is in its beta stage. Run the following command to enable
the assets of tdCorePlugin:
$ ./symfony plugin:publish-assets
One of the assets is nice CSS file cooperating with other TD CMF plugins.
This plugin is the main part of the TD CMF and therefore it should be
installed as the first one. Other td components will use functionalities
provided with tdCorePlugin.
Enable the file in your apps/backend/config/view.yml file:
stylesheets: [ /tdCorePlugin/css/td_admin.css ]
- td_short_text_sign_count - character count of a short descrtiption of any
kind of object used among admin generators (used by tdSubpage,
tdGuestbookPlugin, tdAudioPlugin, tdVideoPlugin and so on)
tdConfig is a model representing dynamic configuration options in your symfony
project. It is provided with the tdConfig backend module enabing easy
configuration options management. Just enable the module in your
backend/config/settings.yml file:
enabled_modules: [ ... , tdConfig ]
tdSubpage is a Sluggable model representing subpages in your symfony project.
Enables easy management of pages with dynamic content. Use it in your frontend
application - in actions, components and layout templates:
link_to('Example Subpage', 'tdSubpage', $subpage)
This part is based on isicsBreadcrumbsPlugin. It includes a singleton managing
breadcrumb items. Displaying breadcrumbs is done using a component. At first,
enable the tdBreadcrumb module:
enabled_modules: [ ... , tdBreadcrumb ]
Define the path in your templates:
<?php $breadcrumbs->addItem('My action', 'myModule/myAction') ?>
=> Home > My action
If the action is deeper:
<?php $breadcrumbs->addItem('My previous action', 'myModule/myPreviousAction') ?>
<?php $breadcrumbs->addItem('My action', 'myModule/myAction') ?>
=> Home > My previous action > My action
Define the path in your actions:
public function executeMyAction()
{
tdBreadcrumb::getInstance()->addItem('My action', 'myModule/myAction');
=> Home > My action
Include the breadcrumbs component (in the layout for instance):
<p id="breadcrumbs">
You are here :
<?php include_component('tdBreadcrumb', 'display') ?>
</p>
You can set your own root:
<p id="breadcrumbs">
You are here :
<?php include_component('tdBreadcrumb', 'display', array(
'root' => array('text' => 'Home', 'uri' => '@myHomepage')
)) ?>
</p>
Some of TD CMF plugins use AJAX actions to provide user-friendly interface
(such as tdGuestbookPlugin). Enable the graphics module from tdCorePlugin to
enable AJAX actions in other plugins to run correctly:
enabled_modules: [ ... , graphics ]
More about TD CFM AJAX backend feature in my symfony developer
blog
The icons provided with the plugin may be used for sfAdminDashPlugin. To do so,
you need to do the following:
modify the sfAdminDashPlugin/config/app.yml file, set:
image_dir: /tdCorePlugin/images/icons/
and finally you may use the icons in the app.yml file:
categories:
Administration:
items:
Newsletter:
url: newsletter
image: newsletter.png
There is a class in the plugin responsible for generating some random data used
for the symfony fixtures. During development phase its essential to see how some
mechanisms work when real data is available in the database. Writing the same
methods many times is useless - that's where random data generator comes in. an
example to generate some data in data/fixtures/sample.yml file is shown below:
<?php $generator = new tdRandomDataGenerator(); ?>
Guestbook:
<?php for($i = 0; $i < 150; $i++): ?>
guestbook_<?php echo $i ?>:
author: <?php echo $generator->getRandomName()."\n" ?>
email: <?php echo $generator->getRandomEmail()."\n" ?>
http: <?php echo $generator->getRandomHttp()."\n" ?>
text: <?php echo $generator->getRandomText(mt_rand(20,100)*mt_rand(1,5))."\n" ?>
<?php endfor; ?>