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
8243
Activity
How to change default file extension for views
Depends. If you just want to use the standard PHP views (HTML + embedded PHP) but you don't like the extension, the answer is no. If you want to use the twig template engine for your views, you should use the Parser package, which will add te…
Comment by
WanWizard
March 2013
permalink
Fatal error in FuelPHP installation
No write access to the log folder is the most likely cause. Followed by no write access to the cache folder.
Comment by
WanWizard
March 2013
permalink
Can I pass controller data to an observer?
No, the observer observes actions in the ORM Model, it is not aware something like a controller even exists. The observer does have access to the current ORM object, so you could store the data in the ORM object in your controller, and retrieve it …
Comment by
WanWizard
March 2013
permalink
Return response in Before Method in REST Controller
The router() method in the controller has nothing to do with the Router class? The router method is documented here: http://fuelphp.com/docs/general/controllers/base.html#/router The routing process determines which controller/method to call. If t…
Comment by
WanWizard
March 2013
permalink
Multi view in one
FuelPHP uses encoding on output as a security feature. What you do works, but it will print the HTML instead of interpreting it, and this is because it's encoded. Use this instead: $this->template->set_safe('content', $a.$b);
Comment by
WanWizard
March 2013
permalink
Error with Composer
1.6/develop doesn't use the Log package anymore. It was a teriible experiment in 1.5 that went wrong. There is no reference to it anymore in the 1.6/develop branch of the fuel/fuel repo: https://github.com/fuel/fuel/tree/1.6/develop/fuel/packag…
Comment by
WanWizard
March 2013
permalink
Error with Composer
You are using 1.6/develop of the Fuel core packages, but not for your app. So you're missing the composer.json file, and you're missing the composer code in the app bootstrap. And perhaps your index.php is out of date too...
Comment by
WanWizard
March 2013
permalink
Return response in Before Method in REST Controller
As I said: do not use before() to alter the flow. Use router(). In there you can validate the request, return a json error if the API key doesn't validate, and call parent::router() to process the request if it does.
Comment by
WanWizard
March 2013
permalink
ORM returns empty array if one of related items is not found
I don't see why such a query should not be possible, I use queries with complex relations all the time. Just verified in one of the apps I'm working on, but a query like this: Model\Session::query() ->related('location') ->…
Comment by
WanWizard
March 2013
permalink
ORM returns empty array if one of related items is not found
An ORM links parent and child objects by defining a relation between the two, and specifying the FK used to make the relation. The FK is always linked to the PK on the other side of the relation. You define the relation as Model_Record has_one Mode…
Comment by
WanWizard
March 2013
permalink
ORM returns empty array if one of related items is not found
The ORM is a separate package. If you use the zip file, everything installed is the same version, but if you use a cloned repo, you can update each FuelPHP component individually. The generated query looks correct to me for the question you're…
Comment by
WanWizard
March 2013
permalink
how to use files language
You can change the language in the controller, but you have to do it before you create views (or the template in case of Controller_Template). Which means in the before(), and before you call parent::before(). The reason for this is that FuelPHP us…
Comment by
WanWizard
March 2013
permalink
how to use files language
How you use/access it depends on how you load it. http://docs.fuelphp.com/classes/lang.html#/method_load shows you the options in the example. Language strings, like config data, are loaded into a multidimensional array, the level being determined…
Comment by
WanWizard
March 2013
permalink
Undefined variable: new_pk
That looks like a bug. Can you create an issue for it at https://github.com/fuel/orm/issues so it can be looked at?
Comment by
WanWizard
March 2013
permalink
Incomprehensible work validation class
That should work. You will have to think about how to handle validation, since the model has rules for all fields, but not all field values are posted. So it could be that validation will fail on that. If it's only these two fields, you might…
Comment by
WanWizard
March 2013
permalink
ORM returns empty array if one of related items is not found
You can dump the query either by activating the profiler (in your config and db config files), or use DB::last_query() directly after the find. Using reflection should not be needed, if it ignores the conditions it should be fixed. Which version of…
Comment by
WanWizard
March 2013
permalink
ORM returns empty array if one of related items is not found
Problem is that ORM's are about relations, not about things that don't have a relation. Perhaps you should dump the query generated, see if you can modify it to produce the output you want, and then work your way back. But I think it…
Comment by
WanWizard
March 2013
permalink
Incomprehensible work validation class
To start with your last question: you don't. All settings defined on the property are used in constructing the fieldset, including all validation rules. If that doesn't work for you, you're doing something wrong. If you want to exclu…
Comment by
WanWizard
March 2013
permalink
ORM returns empty array if one of related items is not found
By default the relations are added to the query using an INNER JOIN, which means the relation must exist. Check out http://docs.fuelphp.com/packages/orm/relations/intro.html, "Join types" for alternative ways to construct the query.
Comment by
WanWizard
March 2013
permalink
Easiest way to save the logs into a table
If by logs you mean logging information written by the Log class, I would: - upgrade to 1.6/develop to have full monolog functionality - copy the MongoDBHandler from Monolog, rename it, and modify it to use Fuel's DB class - use \Log::instance…
Comment by
WanWizard
March 2013
permalink
Selective output filtering
You pass data to a view without encoding using the View objects set_safe() method, or with set() using false as third parameter.
Comment by
WanWizard
March 2013
permalink
Updating my slug
If I look at the observer code, I don't see any reason why it wouldn't update the slug. before_update() will check if one of the source fields has changed, and if so, it will call before_insert() to create a new slug and store it in the d…
Comment by
WanWizard
March 2013
permalink
upload wmv file with upload class
I don't know what the error is, because you haven't told me. Get the errors from the upload class, it will tell you exactly what the problem is. It could very well be that the post size is limited in your php.ini, so PHP itself refuses to…
Comment by
WanWizard
March 2013
permalink
upload wmv file with upload class
What exactly doesn't work? The mime type is not relevant unless you validate on it. So start by disabling all validations. If you dump the file array, you'll see what mime type your server thinks the file is...
Comment by
WanWizard
March 2013
permalink
What is the best way to redirect user to previous page
You are right, as said I just typed something in from the top of my head. You can use Uri::current() to get the current Uri and store that, the referer is even a bad idea because it's not the current URI, it's the one you came from...
Comment by
WanWizard
March 2013
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,390
Last Active
11:59AM
Roles
Administrator