Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Sending parameter value in viewmodel
  • i want to send parameter in view model.
    i have tryed to do this 
    Response::forge(ViewModel::forge('template/productslist','category',123,$view));

    at the viewmodel
    class View_Template_Productslist extends ViewModel
    {    public function category($at)
    {
    $this->list =  Model_Product::get_product_all($at);
    }  
    but it is not working , theri is error saying 1 arrgument missing 

    please help
  • HarroHarro
    Accepted Answer
    Viewmodel::forge() doesn't have the option to pass variables, like a View has.

    So you need to use:
    - set()
    - set_safe()
    - property assignment ( like $viewmodel->at = 123; )

    In the Viewmodel, you use $this->at to retrieve the value...
  • thank you very much  sir it really help.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion