CakePHP is giving me a mysterious error when trying to create a new view via $view = new View($this, false) on my server. The script runs perfectly on my local machine. On the server it says the view, that i want to render via this method wasn't found.
I have already tried chown/chmod. The file rights of all View files are all the same.
The URL to the guide which explains the concept is the following:
http://wp.headynation.com/cakephp-get-htmloutput-of-view-without-view-displaying-or-outputting-using-render/
Thank you
I found the solution: I have to use $view->render('/Exports/_users.ctp'); instead of $view->render('_users');
Related
I have created custom database column in magento 'wholesale_min_qty' in cataloginventory_stock_item.
Question is, I cant update the field by importing from CSV file.
But it is working perfectly fine when updating from admin panel.
Any idea?
I have solved it, by going to
Mage_ImportExport_Model_Import_Entity_Product.
find the function _saveStockItem().
add 'wholesale_min_qty => 0' to $defaultStockData array.
This is done by hard coding to magento core file. You can try to create a module to extend the core file itself, which is a best practice.
I am using the following code to check the logged in user's group (cakephp 1.3)
Session->read('Auth.User.user_group_id') != User::USERLEVEL_USER) :?>
(this is in .ctp file)
and now am migrating to cakephp 2. and this code is not working.
cant find any results when I googled .
Could anyone shed some light on this
in cakephp 2.x you're sending variables to view, so you don't have access to User class. you should get instance of this class in controller and send it as a variable to view.
please use this plugin to improve your debugging skills:
https://github.com/cakephp/debug_kit
I'm new in CakePHP. Currently I got a problem in my task.
I had assigned to create a Plugin name UserManagement and Login in app/Plugin/
The Plugin UserManagement already has completed. But now I having a problem in Plugin Login. Actually I need to use User Model from Plugin UserManagement in Plugin Login. However, I don't know how to write a scripts and what steps first I should taken?
I try before, create LoginsController in Controller. But It display an error mentioned that I need to create Model first. Infact that, I actually plan to use Model from UserManagement.
Please assists. Thank you.
Sorry..my English is bad. TT_TT
You have to add
$this->loadModel(PluginName.ModelName);
in our controller and then
$data = $this->ModelName->find('WhatEver');
Hope this will give you some help.
In my application (CMS for internal purposes) I'm facing the problem how to serve pages stored in the database with dynamic URL (e.g. http://example.com/page3) using the JSF. Generally, let's say I want to grab the page content from the database, put it inside jsf file and serve it as /page3. Is there any way how to obtain the request URL from JSF, search the database for the article (instead of searching *xhtml in the WAR), build dynamically the JSF XHML file and return it to JSF as InputStream for example? I've found this answed by Thomas Maerz, but it failed with
Unable to create a new instance of 'com.test.CustomResourceResolver': java.lang.InstantiationException: com.test.CustomResourceResolver
on my glassfish v4 (Mojarra 2.2), and I also found that ResourceResolver is deprecated in JSF2.2.
I've googled a lot, but this seems to be not very common/documented part of JSF.
Thank you for any help.
I did not understand fully the problem, but for url change you can use prettyfaces, for dynamic forms you can use primefaces ext and I am not suggest keep form in the database, if I know your target I can suggest more useful answer.
I have problem with session in cakephp.I have one file chat.php that is in webroot folder but when I run that file with ajax I could not find session which is created from chat.ctp file.
so anyone has idea how to get session in third party file in cakePHP.
can I write session any .ctp file ?
Thanks.please help me.
Yes, it's totally possible.
In APP/config/core.php, find the "Session.cookie" config value:
Configure::write('Session.cookie', 'CAKEPHP');
Then, in your external file, just set the same session name when you start your session:
session_name('CAKEPHP');
session_start();
print_r($_SESSION);
I have heard that this is a spotty thing but for me, the solution above has worked in two projects so far.
I'm assuming you're using the Session component to write the session variable and then trying to read it from a regular 'ol php file outside of cake's scope using the $_SESSION variable.
As you have figure out, this is not guaranteed to work properly. The best way to handle this would be to integrate your chat.php file into cake, using a controller, action and view.
If this for some strange reason isn't possible, you would need to import all the files responsible for setting up cake and instantiate the session component and use that to read from your session. I'd strongly recommend going with way #1.
I don't think it's a good idea to use the third party session in CakePHP since Cake has already done that very well.And I believe the best place to make some sessions is controller,not view.See Session in Cakephp's cookbook and Ajax helper of Cake.Probably they would help.