fuelphp

Dynamic added form fields based on 1-to-n relation - What framework alternatives? [closed]

让人想犯罪 __ 提交于 2019-12-22 18:51:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . We have to develop a multi-model form that should use ajax calls to dynamically add or remove, sub-model fieldsets. For example, let's imagine this team form scenario : Team: Team Name: Team Country: Members: Member A name: Member A age: [add another member] [REGISTER TEAM AND MEMBERS] We are using Yii at the

How to check whether the Redis server is running

无人久伴 提交于 2019-12-21 03:12:08
问题 How to check whether the Redis server is running? If it's not running, I want to fallback to using the database. I'm using the FuelPHP framework, so I'm open to a solution based on this, or just standard PHP. 回答1: What you can do is try to get an instance (\Redis::instance()) and work with it like this: try { $redis = \Redis::instance(); // Do something with Redis. } catch(\RedisException $e) { // Fall back to other db usage. } But preferably you'd know whether redis is running or not. This

How to check if a constant exists in PHP

给你一囗甜甜゛ 提交于 2019-12-18 03:00:48
问题 So I'm using a PHP framework called fuelphp , and I have this page that is an HTML file, so I can't use PHP in it. I have another file that has a top bar in it, which my HTML file will call through ajax. How do I check if a constant exists in PHP? I want to check for the the fuelphp framework file locations. These are the constants I need to check for (actually, I only have to check one of them): define('DOCROOT', __DIR__.DIRECTORY_SEPARATOR); define('APPPATH', realpath(__DIR__.'/fuel/app/')

MySQL Error - SQLSTATE [42000]: Syntax error or access violation: 1064 [closed]

戏子无情 提交于 2019-12-14 03:05:44
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I've looked through the suggested code and cannot find an answer that fixes the problem so I am asking away. I am using MAMP v2.0.5, MySQL v5.5.9, PHP v5

SQLSTATE[42000]: Syntax error or access violation: 1305

吃可爱长大的小学妹 提交于 2019-12-13 19:19:36
问题 I've been using FuelPHP to develop a new web application. Today, all of a sudden, errors started appearing when I try to add information to the database. I can still retrieve information from the database so the login information must be correct. However when I try to add info I'm getting the following error message: Error - 2012-08-06 15:48:37 --> Error - SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION dan_monline.LOWER does not exist with query: "SELECT LOWER ( name ) FROM

FuelPHP Oil Migration not working

旧街凉风 提交于 2019-12-13 09:54:04
问题 I have xampp installed and want to get FuelPHP working. Everything seems to work fine, I scaffolded some stuff, that I want to migrate. But I get the error Error - invalid data source name in COREPATH/classes/database/pdo/connection.php on line 94 My db.php looks like this: return array( 'default' => array( 'type' => 'pdo', 'connection' => array( 'dsn' => 'mysql:host=127.0.0.1;dbname=pfpg', 'username' => 'root', 'password' => '', 'persistent' => false, 'compress' => false, ), ), ); I tried it

Fuelphp ORM related limit ignored

徘徊边缘 提交于 2019-12-12 03:38:38
问题 I ran in to a problem what i never experienced with fuelphp. On the users profile page i allow other users to leave comments. And when i use related comments limit in my controller function its just ignored. Code public function action_view($id) { $user = Model_User::find($id, array( 'related' => array( 'comments' => array( 'order_by' => array( array('id', 'DESC'), ), ), ), 'limit' => 5, )); if(empty($user)): Response::redirect(Uri::base() . "welcome/404"); endif; $this->template->title =

How do I return JSON Arrays instead of objects using FuelPHP's ORM and Controller_Rest

最后都变了- 提交于 2019-12-12 02:55:58
问题 Controller_Something extends Controller_Rest { public function get_something() { $query = Model_Something::query()->related('hasMany')->get(); return $this->response($query); } } Returns: { stuff: here, looks: good, hasMany: { 151251: { id: 151251, other: stuff } } } I want the relations as arrays: { stuff: here, looks: good, hasMany: [ { id: 151251, other: stuff } ] } This happens because the ORM returns related result arrays with keys corresponding to the record's PKEY, and JSON interprets

Pass parameters to Presenters (fuelphp)

放肆的年华 提交于 2019-12-12 01:41:58
问题 How does one pass a parameters to a Presenter? Reading the documentation there doesn't seem to be a way. https://fuelphp.com/docs/general/presenters.html Controller $points = Presenter::forge('points', 'viewmy'); $points->set('id', 5); Presenter class or view (I tried both): var_dump($id); var_dump($this->id); Both var_dumps generate an undeclared variable error This in the Presenter class also did not work: $id = $this->get('id'); 回答1: From the page you linked: In your code, Views and

Allow my API to be access via AJAX

半世苍凉 提交于 2019-12-11 22:14:14
问题 I have an API that fetches some date on the server. public function post_events() { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET, POST'); header("Access-Control-Allow-Headers: X-Requested-With"); $city = Input::post('city','all'); $c = Model_chart::format_chart($city); return $this->response($c); } It works fine on usual curl methods. But I am trying to access it using $http on Angular.js and it gets me this error. XMLHttpRequest cannot load http://event