Where are Magento’s log files located?

You can find them in /var/log within your root Magento installation There will usually be two files by default, exception.log and system.log. If the directories or files don’t exist, create them and give them the correct permissions, then enable logging within Magento by going to System > Configuration > Developer > Log Settings > Enabled …

Read more

MongoDB and CodeIgniter [closed]

I’m not sure if its the “CodeIgniter way” but I created a CodeIgniter library that extends the Mongo class with an extra property to store the current database connection. Here are the relevant code files from my project. config/mongo.php $config[‘mongo_server’] = null; $config[‘mongo_dbname’] = ‘mydb’; libraries/Mongo.php class CI_Mongo extends Mongo { var $db; function CI_Mongo() …

Read more

Arrays with NULL keys

Quote from the manual: Null will be cast to the empty string, i.e. the key null will actually be stored under “”. Additional details about how keys are cast are as follows: The key can either be an integer or a string. The value can be of any type. Additionally the following key casts will …

Read more

PHP using Gettext inside

As far as I can see in the manual, it is not possible to call functions inside HEREDOC strings. A cumbersome way would be to prepare the words beforehand: <?php $world = _(“World”); $str = <<<EOF <p>Hello</p> <p>$world</p> EOF; echo $str; ?> a workaround idea that comes to mind is building a class with a …

Read more

How to use a PHP class from another file?

You can use include/include_once or require/require_once require_once(‘class.php’); Alternatively, use autoloading by adding to page.php <?php function my_autoloader($class) { include ‘classes/’ . $class . ‘.class.php’; } spl_autoload_register(‘my_autoloader’); $vars = new IUarts(); print($vars->data); ?> It also works adding that __autoload function in a lib that you include on every file like utils.php. There is also this post …

Read more

How to use sha256 in php5.3.0

Could this be a typo? (two Ps in ppasscode, intended?) $_POST[‘ppasscode’]; I would make sure and do: print_r($_POST); and make sure the data is accurate there, and then echo out what it should look like: echo hash(‘sha256’, $_POST[‘ppasscode’]); Compare this output to what you have in the database (manually). By doing this you’re exploring your …

Read more

Symfony2 – Twig – How can I send parameters to the parent template?

Here is a simple example: base.html.twig: {# base.html.twig #} … <ul> <li{% if menu_selected|default(‘one’) == ‘one’ %} class=”selected”{% endif %}>One</li> <li{% if menu_selected == ‘two’ %} class=”selected”{% endif %}>Two</li> <li{% if menu_selected == ‘three’ %} class=”selected”{% endif %}>Three</li> </ul> … page2.html.twig: {# page2.html.twig #} {% extends ‘YourBundle::base.html.twig’ %} {% set menu_selected = ‘two’ %} Output …

Read more