Coder Social home page Coder Social logo

Comments (4)

xtrasmal avatar xtrasmal commented on June 19, 2024

I would advice to watch the tutorial video on Models. There is a part that tells you how to use criteria.
You could make a form, which routes to Search. So the form action would be action="search".

So if you want to have the user look though a database table which has Posts, which you want to sort by date
then you would have a route like this:

'GET:search' => array('route' => 'Posts.Search'),

Then in the PostsController.php you could add a function:

public function Search()
{
    require_once 'Model/PostsCriteria.php';

    // From date, that the user selected
    $fromDate =  RequestUtil::Get("FromDate");
    // To date, that the user selected
    $toDate =  RequestUtil::Get("ToDate");

    // use Post criteria, to create a custom Query
    $criteria = new PostsCriteria();
    $criteria->Date_GreaterThanOrEqual = $fromDate;
    $criteria->Date_LessThanOrEqual = $toDate;

    // Then run the Query on the posts db table
    $posts = $this->Phreezer->Query('Posts', $criteria);

    // Then display the search results
    foreach ($posts as $post)
    {
        echo $post->Name . '<br/>';
    }
}

Hope this helps.

from phreeze.

josemalone avatar josemalone commented on June 19, 2024

Hey, thank you!

Yes, I have watched the videos which have made MVC much clearer to me. I just couldn't make the jump from static criteria to variable criteria from the web client. Let me see if I can take your lead and make this work.

Thank you, again.

from phreeze.

xtrasmal avatar xtrasmal commented on June 19, 2024

Awesome man, love your attitude. You will love Phreeze, I can smell it. Working with Phreeze opened up my view on MVC also.
I really want you to stick around and keep using Phreeze. It's bleeding edge software and a rough diamond with bad documentation, but it's heart is smart and strong.

from phreeze.

jasonhinkle avatar jasonhinkle commented on June 19, 2024

Thanks guys! I started the Phreeze wiki where I hope some documentation might start appearing soon with the help of anybody who wishes. I will try to start working on it little by little as well.

https://github.com/jasonhinkle/phreeze/wiki

-j

from phreeze.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.