sfSimplePagePlugin - 1.0.3

Enable managing static pages with symfony

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source



The sfSimplePagePlugin allows you to manage like static pages with symfony.

for example, if the request is like this


the module of this plugin, which is sfSimplePage module, render the sample.html in ./data/static directory.

if the request is like this


render the sample2.html in ./data/static/hoge directory.

These page is rendered by symfony, so you can use view system of partial, component, helper...


  • 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()
  • Enable this sfSimplePage module in your setting.yml

        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 : 
    ><php echo link_to( 'About', '@sfSimplePageFile?file=about.html')>
  • [Optional] I18n support is provided through the classical means of session user culture (sf_culture parameter)

    In application app.yml add  
        sf_simple_page_plugin_use_i18n: true 
    to enable i18n support
    Now the session user culture (e.g. en, gr) 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
    >    en/
    >        help.html
    >        /about.html
    >    el/
    >        help.html
    >        about.html
    The application is responsible for management of a sane sf_culture session variable. 
    Read i18n support in "symfony book".
  • [Optional] Use the component sfSimplePage/static ('file'=>$file) from anywhere in the view layer to embed static content on every page you desire.

    e.g. in apps/frontend/modules/product/templates/showSuccess.php


>< php include_component('sfSimplePage','static', array('file'=>'terms.html') ) > >
  will output the contents of terms.html file inside the #terms div !


  • The names of the route prefix and the static content directory can be changed from the application app.yml configuration file

    e.g. in apps/frontend/config/app.yml:

    all: sf_simple_page_plugin_route_prefix: documentation sf_simple_page_plugin_template_path: %SF_DATA_DIR%/doc This will mean that the route prefix for static content is documentation (i.e. domain.com/index.php/documentation) and that the file data are in data/doc relative to sympfony root on a typical installation