![]() |
|
sfSimplePagePlugin - 1.0.6Enable managing static pages with symfony |
|
![]() |
11
users
Sign-in
to change your status |
Enable managing static pages with symfony |
The sfSimplePagePlugin allows you to manage like static pages with symfony.
| Name | Status | |
|---|---|---|
|
|
lead | moc.liamg <<ta>> revir.trb |
|
|
developer | moc.liamg <<ta>> ailexon |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.6stable | MIT license | 1.0.0stable | 08/03/2012 |
| 1.0.4stable | MIT license | 1.0.0stable | 10/09/2010 |
| 1.0.3stable | MIT license | 1.0.0stable | 15/03/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.6stable | MIT license | 1.0.0stable | 08/03/2012 |
| 1.0.4stable | MIT license | 1.0.0stable | 10/09/2010 |
| 1.0.3stable | MIT license | 1.0.0stable | 15/03/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.4stable | MIT license | 1.0.0stable | 10/09/2010 |
| 1.0.3stable | MIT license | 1.0.0stable | 15/03/2010 |
| 1.0.2stable | MIT license | 1.0.0stable | 12/11/2009 |
| 1.0.1stable | MIT license | 1.0.0stable | 09/11/2008 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.4stable | MIT license | 1.0.0stable | 10/09/2010 |
| 1.0.3stable | MIT license | 1.0.0stable | 15/03/2010 |
| 1.0.2stable | MIT license | 1.0.0stable | 12/11/2009 |
| 1.0.1stable | MIT license | 1.0.0stable | 09/11/2008 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.4stable | MIT license | 1.0.0stable | 10/09/2010 |
| 1.0.3stable | MIT license | 1.0.0stable | 15/03/2010 |
| 1.0.2stable | MIT license | 1.0.0stable | 12/11/2009 |
| 1.0.1stable | MIT license | 1.0.0stable | 09/11/2008 |
The sfSimplePagePlugin allows you to manage like static pages with symfony.
for example, if the request is like this
http://example.com/frontend_dev.php/static/sample.html
the module of this plugin, which is sfSimplePage module, renders the sample.html in ./data/static directory.
If the request is like this
http://example.com/frontend_dev.php/static/hoge/sample2.html
render the sample2.html in ./data/static/hoge directory.
These pages are rendered by symfony, so you can use partials, components, helpers, or any other php statement.
Install plugin:
symfony plugin:install http://plugins.symfony-project.com/sfSimplePagePlugin
or through Subversion:
svn co http://svn.symfony-project.com/plugins/sfSimplePagePlugin/trunk
(only symfony 1.2+) Enable this plugin in ProjectConfiguration.class.php
public function setup() { $this->enablePlugins('sfSimplePagePlugin'); }
Enable this sfSimplePage module in your application settings.yml
all:
.settings:
enabled_modules: [default, sfSimplePage]Make "static" directory in data directory
mkdir ./data/static
Deploy your template in ./data/static directory
Clear cache
./symfony cc
[Optional] Use the sfSimplePageFile routing rule to create links to files in the static root dir
e.g.in template :
echo link_to( 'About', '@sfSimplePageFile?file=about.html')
[Optional] I18n support is provided through the classical means of session user culture (sf_culture parameter)
To enable i18n support, in application app.yml add:
all:
sf_simple_page_plugin:
use_i18n: true
Now the session user culture (e.g. en, el) is interpreted as a first implicit directory. Also when the static file is not found under the culture dir a final attempt is made on the static folder before giving a 404 error.
Example contents of static folder
static/
en/
help.html
about.html
el/
help.html
about.html
The application is responsible for the management of a sane sf_culture session variable. Read i18n support in "symfony book" for more.
[Optional] Use the component sfSimplePage/static ('file'=>$file) from anywhere in the view layer to embed static content on every page you desire. In case you need to provide a different file path provide a 'file_path'=><path_to_static_dir>.
e.g. in apps/frontend/modules/product/templates/showSuccess.php
<div id="terms">
<?php include_component('sfSimplePage','static', array('file'=>'terms.html') ) ?>
</div>
will output the contents of terms.html file inside the #terms div !
The route prefix and the static content directory can be changed from the application app.yml configuration file. Also the routes can be disabled, in this case new routes have to be defined at the main routing.yml file. The sfSimplePagePlugin parameters, along with their default values are as follows:
E.g. in apps/frontend/config/app.yml:
[yml]
all:
sf_simple_page_plugin:
template_path: '%SF_DATA_DIR%/static'
route_prefix: static
use_i18n: false
routes_register: true
