controller

Undefined Variable error in View

孤街醉人 提交于 2019-12-11 10:13:52
问题 My controller is in this question: how to add pagination to this But now, i'm getting undefined variable in my view, View has an input <input name='query'/> which i receive it in controller as, $query = $this->input->get('query'); Now, i am trying to pass the same query string back into my view inside the link of pagination. <a href="<php echo base_url(); ?>main/search/query=<?php echo $query; ?>&off=<?php echo $off=5;">1</a> $off works but not $query . But i'm NOT saving the $query to the

yii RBAC and yii controllers access rules

南笙酒味 提交于 2019-12-11 10:03:37
问题 I'm trying to customize RBAC, so I've made several roles for users. Now I'm trying to understand how to tell to controller which action should be accessed by which role. In Controllers code I see this public function accessRules() { return array( array('allow', // allow all users to perform 'index' and 'view' actions 'actions'=>array('index','view'), 'users'=>array('*'), ), array('allow', // allow authenticated user to perform 'create' and 'update' actions 'actions'=>array('create','update'),

Designing mvc controller layer

做~自己de王妃 提交于 2019-12-11 10:00:50
问题 I am trying to understand and practice the MVC-pattern to improve my development. So I started refactoring an application I once wrote and have progressed so far. It is completely clear how my model looks like and also the view is ready so far. But now I am searching for a good practice to design my controller layer. I have created a view that's split up in different main components. Let me give you a short example: There are 3 Panels that group specific components: "FilePanel", holding a

Yii2: how to use component in ActiveController default action

烈酒焚心 提交于 2019-12-11 09:55:13
问题 As docs say: [[yii\rest\IndexAction|index]]: list resources page by page response has view: curl -i -H "Accept:application/json" "http://192.168.100.5/index.php/tweets" HTTP/1.1 200 OK Date: Wed, 30 Mar 2016 12:10:07 GMT Server: Apache/2.4.7 (Ubuntu) X-Powered-By: PHP/5.5.9-1ubuntu4.14 X-Pagination-Total-Count: 450 X-Pagination-Page-Count: 23 X-Pagination-Current-Page: 1 X-Pagination-Per-Page: 20 Link: <http://192.168.100.5/tweets?page=1>; rel=self, <http://192.168.100.5/tweets?page=2>; rel

Update action seems to be doing nothing

天大地大妈咪最大 提交于 2019-12-11 09:54:45
问题 Currently,I have a overtime_definition_controller with methods like this class Edms::OvertimeDefinitionsController < ApplicationController require 'will_paginate/array' layout :compute_layout def new @flag = params[:flag] @employee = Employee.find(params[:id]) @overtime = OvertimeDefinition.new end def create @employee = Employee.find(params[:overtime_definition][:employee_id]) @overtime = OvertimeDefinition.new(params[:overtime_definition]) if (params[:half_day_extra_duty_hours][:hour].to_s

Laravel Passing Data to Controller

爱⌒轻易说出口 提交于 2019-12-11 09:42:22
问题 I just starting learning laravel and was wondering how to pass data unrelated to the route to a controller. What I'm trying to accomplish is create a todo item that is able to have nested items. View <a class="btn btn-success" href="{{route('lists.items.create',4)}}">Create New Item</a> The 4 is just a hard-coded example to see if it was working. Controller public function create(TodoList $list, $item_id = null) { dd($item_id); return view('items.create', compact('list')); } So if your

How to pass data from Java to FXML? [duplicate]

孤者浪人 提交于 2019-12-11 09:06:59
问题 This question already has answers here : Passing Parameters JavaFX FXML (11 answers) Closed 3 years ago . In the Controller(or maybe the Main or another file, I'm not sure how all this works), we have the following: String foo = "Foo."; And in Scene Bilder-generated FXML, something like this: <Button mnemonicParsing="false" prefHeight="25.0" prefWidth="61.0" text="Browse" /> How do I make the value of foo appear as the text on the button? And where should I store it, the controller or

CSS doesn't work when I add slash (/) at the end of my url

给你一囗甜甜゛ 提交于 2019-12-11 08:48:55
问题 I'm new to code igniter and I wonder why my css doesn't work when I add slash ( / ) at the end of the url .. Can someone help me why it doesn't work ? And help me make it work ? 回答1: Try this add code to your html head : <link rel="stylesheet" href="<?php echo site_url('css/style.css');?>" type="text/css"/> or <link rel="stylesheet" href="<?php echo base_url();?>css/style.css" type="text/css"/> 回答2: CodeIgniter has method: site_url() - which generates your home url with '/' (slash) at the end

Catchable Fatal Error: Argument 1 passed to ? Symfony2.1

坚强是说给别人听的谎言 提交于 2019-12-11 08:26:13
问题 I am stopped by this error: Catchable Fatal Error: Argument 1 passed to Joker\CoreBundle\Entity\Incidentfile::setFile() must be an instance of Symfony\Component\HttpFoundation\File\UploadedFile, string given, called in /Applications/MAMP/htdocs/joker-repo/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php on line 538 and defined in /Applications/MAMP/htdocs/joker-repo/src/Joker/CoreBundle/Entity/Incidentfile.php line 157 In my entity I have setters and getters for File. I

make controller return HTML or JSON depending on request type

倖福魔咒の 提交于 2019-12-11 07:57:14
问题 I want to know if there is a way in Grails to return HTML or JSON depending if I make a GET to an action or if I just call an action through Ajax. For example, if I make an Ajax call to "controller/action", is there a way to return JSON and if I go to the same "controller/action" trough a link, make it render an HTML page? or i have to define two diferent actions? 回答1: Typically all AJAX requests have X-Requested-With header set. You can check if this header is set and render desired format