In Smarty display method not working - smarty

Display method not working only print "kamal" not print "maisuriya"
Please help me?
print("kamal");
$tpl->display('default_layout'. $config['tplEx']);
print("Maisuriya");

If you're not seeing any error messages, you might want to activate them (temporarily) with ini_set("display_errors", true); error_reporting(E_ALL);
If you're using Smarty3 run a $tpl->testInstall(); after you've setup Smarty to see if everything is ok. Then check if your template exists with $tpl->templateExists('default_layout'. $config['tplEx']);
My guess is either the requested file doesn't exist, or the template contains syntax errors, or some function called within the template did not execute properly. But without the error message, I can't tell.

Related

CakePHP 4 - view helper - error reading session values

I am still fairly new with CakePHP and leaning with version 4. I can read PHP session values in a template index.php file with below. I think that is wrong way to do but I tested anyway.
$userrole_id = $this->request->getSession()->read('Auth.userrole_id');
And now I am trying to read session values in View Helper so that I can use same code in many different places. But above code throws an error with "Call to a member function getSession() on null". And as you can see in the above one line code, I have Authentication set up and that is working fine. And I have helper loaded in AppView.php, and that is loaded fine, too.
I am pretty sure I am missing basic stuff but I cannot figure it out. Any suggestions would be appreciated.
I found a solution in the official documentation, and I needed to do like below:
$this->getView()->getRequest()->getSession()->read('Auth.userrole_id');

Magento cant make an order

I have an installation of Magento 1.9.2. I am using a custom theme, and anytime I try and place an order it kicks off the Ajax on the page and then stops with no error messages, but does leave a log:
ERR (3): User Error: Some transactions have not been committed or rolled back in /html/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 4039
I have spent 2 days trying to get to the bottom of this with no joy. It doesn't matter what payment method I use its always the same.
You should try to log all MySQL queries to see what wrong here. lib/Varien/Db/Adapter/Pdo/Mysql.
Open the file lib/Varien/Db/Adapter/Pdo/Mysql.php and change the value of the protected property $_debug to true. You can also change the value of $_logQueryTime which is especially handy when debugging slowdowns. Once you make this change all queries will be logged in the file var/debug/pdo_mysql.log
Hope this will help you. Please put your corrupted query here if you fixed it.
I had today the same problem. Magento 1.9.2.4 with a custom theme. Everything worked fine, expect the checkout-process. The custom theme used the PHP short open tag <? php code ?> . After enabling short_open_tag in the php.ini, everything works fine.

Magento, what could cause $model->load($id) to fail?

I wrote a module for magento, and tested in my localhost. It was working like a charm.
But after uploading to a server, when I try to load a product with the following code:
$product = Mage::getModel('catalog/product')->load($id);
the code execution stops. No exception.log generated. no output to browser.
By outputing to system.log i was able to verify a correct id was being used, and there is a product with that id in the store.
this load method is used by the default catalog/product controllers and works, but its not working in my module.
edit:
I've debbuged and got it to output something to system.log.
2013-09-02T20:49:33+00:00 ERR (3): Recoverable Error: Argument 3 passed to Mage_Eav_Model_Entity_Abstract::_canUpdateAttribute() must be an array, null given, called in /home/next/public_html/app/code/core/Mage/Catalog/Model/Resource/Abstract.php on line 545 and defined in /home/next/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 1254
2013-09-02T20:49:33+00:00 ERR (3): Warning: array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The second argument should be either an array or an object in /home/next/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 1256
I dont think that was originated in my module, since i uploaded it to a clean store and it was working like it should. That store has almost 15 modules installed and one of them is probably overriding something that shouldn't, or maybe the store owner changed something in original magento source code.
I recommended to disable module by module so he can discover what module is causing the problem and revert all possible changes in original source code, but i'm not sure if the store owner will be able to do that.
Isnt there any way i can test current magento installation to be sure my module will work with no conflict with other pre-installed modules??
PHP almost never "just stops" without producing an error. Temporarily edit index.php such that
ini_set('display_errors', 1);
and (or set the MAGE_IS_DEVELOPER_MODE flag to true in your web server)
if (true || isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}
Additionally, check your php error log for any error produced when you run your code.

My Joomla component not displaying anything

I have build my own component. I know very well about these stuff but all of sudden I wonder that the joomla request to my custom component is not displaying anything. Its displaying blank page.
See this:
http://designsoft.bestplacestestserver.com/index.php?option=com_marketplacemanager
Here is the very initial code of 'marketplacemanager.php' file of component where the request is not arriving. Don't know why.
Code - marketplacemanager.php
defined('_JEXEC') or die;
jimport('joomla.application.component.helper');
echo 'aa'; exit; // should have something displayed as here
Go to global configuration. On the server tab turn error reporting to development. Reload the page. Most likely you will now see the error.
Try this, replace the first line of your code with:
defined('_JEXEC') or die('why is blank?');
If still does not show anything it means displaying errors on your server is locked, so checking the error log would be the only option.
The problem has been resolved. Actually MVC naming pattern or something else was wrong. I didn't properly renamed my existing component that I was reusing.

Enabling Views custom module causes an Ajax HTTP error on Drupal 7

I'm working on a custom module that will describe an external table to the Views module. Inside my module folder I have the required mymodule.views.inc file. However, whenever this file is present and my custom module is enabled Drupal constantly gives Ajax HTTP Error pop ups when I use a site feature that has Ajax (any of the spinning daisies trigger this). The pop up always contains the module code in mymodule.views.inc after it says Ajax Error. The weird thing is every time I load the front page the PHP code in mymodule.views.inc is always displayed on the top of the front page.
I've seen this problem on SO and other sites a lot, but most of the time it can be traced back to an updated jquery.js file or a php.ini setting that will give scripts more time to run. So far neither of those fixes have worked. The only way I can make it go away for now is to either disable my custom module, or rename mymodule.views.inc to something else.
Here's an example of what the message looks like (not verbatim copy, since I can't copy from these alert messages in Chrome).
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /?q=admin/structure/views/view/viewiamtryingtocreate/preview/page/ajax
StatusText: parseerror
ResponseText: /*
* header file to my mymodule.views.inc
* file I wrote
*/
//more php code follows
//lots of unicode characters intermittently show up in my source code
\u003C\/div\u003E\n...
//source code continues with lots of unicode characters, not sure what's at the bottom because the alert box is bigger than my screen and I can't scroll on it
Does anyone else know what could be going on?
This error is caused by drupalforfirebug, disabling drupal for firebug should help. or else this patch should work.
Found it. Syntax error hiding at the top of mymodule.views.inc. There was some weird formatting before the opening PHP tag. Not sure why php --syntax-check mymodule.php didn't catch it (I copied mymodule.views.inc to mymodule.php so that I could run the syntax checker on it).

Resources