levelx.me

  • Home
  • Design
    • Freebies
    • Inspiration
    • Tutorials
  • Technology
    • Benchmarks
    • How To
    • News
    • Programming
    • Reviews
  • Entertainment
    • Gaming
  • Life
    • Photography
    • Quotes
    • Self Improvement
  • Resources
    • Themes
    • Tools
    • Wallpapers
  • ETC
    • Do it Yourself
    • places
    • Uncategorized
  • Symfony Admin Generator Calling Actions with Custom Parameters

    The administration module actions can receive custom parameters using the query_string argument in a link_to() helper. For example, to extend the previous _edit_header partial with a link to the comments for the article, write this:

    It filters the comments to display only the ones related to $article. Using the query_string argument, you can specify a sorting order and/or a filter to display a custom list view. This can also be useful for custom interactions.

    Override index function

    public function executeIndex(sfWebRequest $request)
    {
    // For filter.. This code was missing in symfony documentation.
    if ($request->getParameter('filter'))
    {
    $this->setFilters($request->getParameter('project_filters'));
    }
    
    //-----------------
    
    // sorting
    if ($request->getParameter('sort'))
    {
    $this->setSort(array($request->getParameter('sort'), $request->getParameter('sort_type')));
    }
    
    // pager
    if ($request->getParameter('page'))
    {
    $this->setPage($request->getParameter('page'));
    }
    
    $this->pager = $this->getPager();
    $this->sort = $this->getSort();
    }
    

    Similar Posts

    • Fixing IE7 dropping PHP Sessions
    • How Can Dawkins Explain the Perfect Eye in Our Brains?
    • Nokia 5320 Xpress Music Hands ON!
    • Google Nexus One: The Story
    • Circle Dock
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  

    Posted in: Programming

    8 Responses to “Symfony Admin Generator Calling Actions with Custom Parameters”

    B@D on September 1st, 2009 at 9:08 PM

    Wasn’t this a general Technology blog ?

    admin on September 1st, 2009 at 9:11 PM

    @B@D
    When it was, No one bothered to post :D

    B@D on September 1st, 2009 at 9:20 PM

    It needs Time & Research to Post something Original. ;-)

    Faizan on September 1st, 2009 at 9:28 PM

    Find me this post anywhere on World Wide Web (www) and I’ll stop blogging :P

    It took me whole day just to figure out how to make this thing work.

    And If you cant understand what is this Just leave it. People who know symfony know the worth of this code snippet :D

    sT*rchi1Ð on September 2nd, 2009 at 11:51 PM

    Faizan :

    Find me this post anywhere on World Wide Web (www) and I’ll stop blogging :P

    It took me whole day just to figure out how to make this thing work.

    And If you cant understand what is this Just leave it. People who know symfony know the worth of this code snippet :D

    exactly, btw wht is it? :D

    B@D on September 4th, 2009 at 3:51 PM

    I love symfony.
    Thanks! Great help.

    Faizan on September 4th, 2009 at 6:07 PM

    @sT*rchi1Ð
    Thanks you got my point :P and this is not for you.

    @B@D
    Thanks for appreciation :P btw I know what you mean by this :D

    jarod.chiang on December 1st, 2009 at 2:55 PM

    My Solution is:
    1.
    This article has
    getNbComments().’ comments’, ‘comment/list’, array(‘query_string’ => ‘filter=filter&filters[article_id]=’.$article->getId())) ?> comments.
    2.
    add a function called list in apps/MyApp/modules/commnent
    ==============================================================
    class comment extends autoComment {
    public function executeList(sfWebRequest $request)
    {
    if ($request->hasParameter(‘filter’))
    {
    $this->setFilters($request->getParameter(‘filters’));
    }
    $this->redirect(‘@comment’);
    }
    }
    ================================================================

    [refer to]
    http://www.symfony-project.org/book/1_2/14-Generators

    Leave a Reply

    Categories

    • Benchmarks
    • Design
    • Do it Yourself
    • Entertainment
    • ETC
    • Freebies
    • Gaming
    • How To
    • Inspiration
    • Life
    • News
    • Photography
    • places
    • Programming
    • Quotes
    • Resources
    • Reviews
    • Self Improvement
    • Technology
    • Themes
    • Tools
    • Tutorials
    • Uncategorized
    • Wallpapers

    Explore us

    • deviantART
    • Flickr
    • oDesk
    • Picasa Album
    • Twitter
    • YouTube

    Friends

    • I Am The Stig
    • Stig Facts

    Recent Comments

    • ashwiniverma on Windows 7 Theme – VEER II
      please veer II help me you can understand my pain. my mom and dad is poor and not able to bay me a h... »
    • ashwiniverma on Windows 7 Theme – VEER II
      my internet speed is slow i am using relience net connect hi speed 1x modammodal no: AC8720my downlo... »
    • Jude Sleby on Calibrating HTC Desire Battery
      Looks like it worked »
    • B@D on Pakistan Floods 2010 – How to Donate
      @Aamir - Which area are you from? Where are you living these days? »
    • aamir on Pakistan Floods 2010 – How to Donate
      hy sir i am student of medical last year abroad in osh kirgyzctan.sir i am belonging to flooded effe... »
    • Older »
    levelx.me on Facebook

    Top Posts

    • FORMULA 1 - 2009 Season. (28)
    • Windows 7 Theme – VEER II (18)
    • M2N32 SLI-DLX WFI && RzR DeathADDER - - BURNT ! ! (17)
    • HTC Desire - Benchmark (17)
    • REQ: Stalker [ 1979 ] OST. (15)
    • Collaborations II - Sukhshinder Shinda feat. Rahat Fateh Ali Khan (14)
    • HP Pavilion dv6t Series Notebook PC (14)
    • Action Video Games Could Sharpen Eyesight (14)
    • Long March , The SIT-IN – 2009. (13)
    • Mobile OS wars: Symbian leads globally (13)

    levelx.me is proudly powered by WordPress | Theme Designed by AF8AB

    Valid CSS! Valid XHTML 1.0 Transitional