Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
WanWizard
a.k.a. WanWizard
Discussions
4
Comments
8242
Activity
Asset::img et Asset::find_file and local server / online server
All I can think of is that there is a difference in installation.
Comment by
WanWizard
July 2016
permalink
Asset::img et Asset::find_file and local server / online server
URL in the asset config file should be a relative URI, so use "/" when you gave manually configured a base_url in your config.php file, or don't define it at all when your base_url is auto detected. Now you've made it into an ab…
Comment by
WanWizard
July 2016
permalink
Asset::img et Asset::find_file and local server / online server
Asset doesn't do anything with URL's, it uses the base it is being given when it is instantiated, through the config value 'url'. It also uses the global config value "base_url" to contruct the full URL to the image, so…
Comment by
WanWizard
July 2016
permalink
completely remove login timeout
As I wrote, you can simply set the session cookie timeout to something very long. But that may have side effects, so it is not advised. It is your app, so ultimately your call...
Comment by
WanWizard
July 2016
permalink
completely remove login timeout
Login state is maintained in the session, so technically you can set the session cookie timeout to years to prevent session expiry, but that also means none of the other session data will expire. It is better to use the "remember me" func…
Comment by
WanWizard
July 2016
permalink
Asset::img et Asset::find_file and local server / online server
How asset works depends on now you configure it. Assuming you have the same folder structure locally and on your server, the result should be the same. If you configure "/assets" as your asset path, assets are expected to be in "./pu…
Comment by
WanWizard
July 2016
permalink
Using different DB definitions as default
# make sure the db config is loaded \Config::load('db', true); # make this users' db active \Config::set('db.active', 'database_1234'); Note that if you have your sessions also in the database, this causes all DB…
Comment by
WanWizard
July 2016
permalink
version 2
It is not in a working state at the moment, we're busy with a rewrite for PHP7.
Comment by
WanWizard
July 2016
permalink
How to use validation with multiple models
Your observation is absolutely correct, you do indeed need to merge both error message array's. So your solution is spot-on. Note that the first array() isn't needed, this works fine: Session::set_flash('error', array_merge($va…
Comment by
WanWizard
July 2016
permalink
How to use validation with multiple models
The problem with this is that if the first validation (on model A) returns an error, the second is never executed. Try this instead: $val_A = Model_A::validate('create_A');$val_B = Model_A::validate('create_B'); $result_A = $val…
Comment by
WanWizard
July 2016
permalink
Error: mysql_num_rows() expects parameter 1 to be resource, object given
You can't and shouldn't use mysql functions, DB returns a database result object. It has a method count(), so you can do if ($check_program->count() > 0) { .... }
Comment by
WanWizard
June 2016
permalink
Ormauth: 2 separate sessions for 2 users
Just trying to help. Someone did that for me 30 years ago, I wouldn't be where I am today without him.
Comment by
WanWizard
June 2016
permalink
Ormauth: 2 separate sessions for 2 users
The problem is that that goes against the design of a browser. It is techically impossible to tie a session to a browser window, everything that is client-side storage (cookies, local storage containers) is global in a browser. If the client wants …
Comment by
WanWizard
June 2016
permalink
Ormauth: 2 separate sessions for 2 users
The most simple solution is to use your groups. Create base controllers for public (no authorisation), member (user = member) or admin (user = admin). In the controller's before() method, check if a user is logged in (for the member and admi…
Comment by
WanWizard
June 2016
permalink
Ormauth: 2 separate sessions for 2 users
Questions are never stupid, anwers sometimes are. The short answer is no. The Auth classes uses the default session instance. The long answer: You could extend Auth_Login_Ormauth in your app, and then overload the methods that use the session cla…
Comment by
WanWizard
June 2016
permalink
How to create a user that the two tables would be affected
Always happy to help. Just paying back for all the people that helped me when I was a novice. ;-)
Comment by
WanWizard
June 2016
permalink
How to create a user that the two tables would be affected
If you use relations, foreign keys will be added automatically. $newuser = Model_User::forge(); $newuser->username = 'bla'; $useruser->student = Model_Student::forge(); $useruser->student->course = "PHP 101"; $newu…
Comment by
WanWizard
June 2016
permalink
How to create a user that the two tables would be affected
I must say I am very confused about your code, is this a copy from something else? I see code like $data['student'] = Model_User::find('all', array('related' => array('users'))); which doesn'…
Comment by
WanWizard
June 2016
permalink
How to create a user that the two tables would be affected
Thanks. About the relation: can a user have multiple student records (i.e. multple courses), or is a student only at one at the time?
Comment by
WanWizard
June 2016
permalink
How to create a user that the two tables would be affected
Whether or not two tables are related doesn't have any impact on generating fieldsets, so that has no impact. Can you post both models and your controller on http://bin.fuelphp.com so I can see what you are trying to do?
Comment by
WanWizard
June 2016
permalink
How to create a user that the two tables would be affected
If you use a fieldset, you can use the add_model() method to add the fields of a second model in one go. That might not work well, for example if you have duplicate field names. Alternatively, you can use add() to add individual fields to it. And …
Comment by
WanWizard
June 2016
permalink
How to create a user that the two tables would be affected
I assume that your user and student table have a one-to-many relation? Or is this a one-to-one? And what do you exactly want? You want to create a single form which contains fields from both tables?
Comment by
WanWizard
June 2016
permalink
How to get all children when it's filtered by children field?
Yup, you can do that. Just take into account that these are a lot of joins and a lot of data. Since the ORM caches all objects in memory, you may have to be careful not to select to much data at once.
Comment by
WanWizard
June 2016
permalink
How to get all children when it's filtered by children field?
If you want to show all articles in category 5, you start with $articles = Model\Article::query() ->related('author') ->related('category') ->where('category_id', '5') ->get(); If…
Comment by
WanWizard
June 2016
permalink
Get HTML content inside controller
What do you mean with "get HTML content"? It is not the controller that generates the HTML, it is the rendering of the view (or the theme). And you can do that manually, both have a render() method. $view = View::forge('some/view…
Comment by
WanWizard
June 2016
permalink
More Comments
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
About
Username
WanWizard
Joined
January 2011
Visits
2,368
Last Active
4:01PM
Roles
Administrator