To get a header line in a html list the easiset way is to use the style list-style-type:none
<ul>
<li style="list-style-type:none">Heading</li>
<li>List items</li>
</ul>To get a header line in a html list the easiset way is to use the style list-style-type:none
<ul>
<li style="list-style-type:none">Heading</li>
<li>List items</li>
</ul>If there is a need to get the URI that the was used to reach the controller then the Request holds that information and it can be retrieved to a URI object
public ActionResult MyAction() { var uri = Request.Url; var port = uri.Port; var absoluteUri = uri.AbsoluteUri //... return View(); }
To send a mail from PHP encoded as UTF-8 is fairly easy to do by modifying the headers.
//Sender with special chars (UTF-8) encoded mail('mail@example.com', '=?UTF-8?B?'.base64_encode($subjectString).'?=', $messageString, "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n"); //Sender not UTF-8 encoded mail('mail@example.com', 'sender@mail.com', $messageString, "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n");
The installation package that can be installed from apt includes a console tool to run PHPUnits, but is (currently) not the latest version. One way to get past this is to install PHPUnit from apt and then upgrade PHPUnit via PEAR note: (currently) PEAR needs to be updated as well.
user@devserver~: sudo apt-get install phpunit user@devserver~: sudo pear channel-discover pear.phpunit.de user@devserver~: sudo pear channel-discover components.ez.no user@devserver~: sudo pear channel-discover pear.symfony-project.com user@devserver~: sudo pear update user@devserver~: sudo pear update phpunit/PHPUnit
The line that simply says “sudo pear update” updates pear to the latest version.
During for instance password recovery there is a need to send a break to the router.
In putty (tested with both Windows and Linux) this is done by pressing ctrl+break.
In a multi store environment there is sometimes a need to change the store when the user clicks a link.
A “simple” way to do this is to pass the store along in the url (just add a “?___store=” either id or the store name, so for instance.
$stores = $category->getStoreIds(); echo '<p><a href="'. Mage::getUrl() . '?___store=' . end($stores). '">'.$category->getName()."</a></p>";
Sometimes there is a need to show the name of the current file.
Using $_SERVER['PHP_SELF'] will only show the file that is executed (not the a included file)
Using __FILE__ gives the current file (with a full path)
For this example running.php is accessed in the browser/cli.
//included.php <?php echo $_SERVER['PHP_SELF']; //will show running.php echo __FILE__; //will show included.php ?> //running.php <?php INCLUDE('included.php') ?>
When using the SimpleXml->asXML(‘file.xml’) the output is simply written onto one line.
like
<?xml version="1.0" encoding="UTF-8"?> <product><companyId>1</companyId><productId>1:1</productId></product>
There is nothing wrong with this but if you add line breaks and indentations the xml file looks better and is easier to (manually) read.
Unfortunately there is no way to do this using SimpleXML, but there is a quick and dirty way to do this; and that is to import the SimpleXMLobject to a DOMElement and do it there so some example code
$xmlDom = dom_import_simplexml($simpleXmlObject); $xmlDom->formatOutput = true; $xmlDom->save("test.xml");
This would result in an xml file looking like this:
<?xml version="1.0" encoding="UTF-8"?> <product> <companyId>1</companyId> <productId>1:1</productId> </product>
Easier to read but takes some extra space on the disk (might not be much but it is good to remember).
To add a existing user to a group
usermod -a -G thegroup theuser
To add a user to a group when the user is created
useradd -G thegroup theuserWhen editing Magento tempates or CMS pages you will have a need to access images and other content inside the skin/—/images folder. Instead of making hard coded links in the CMS or templates a better way is to get this from Magento (one of the many reasons for doing this is that it will still work if something in the directory structure is changed – like say you dev server is dev.something/shopverige but the live store is directly on a domain like say http://www.shopsverige.se
Here is how to do it:
<!-- this is inside of .phtml files --> <img src="<?php echo $this->getSkinUrl('images/coolimage.png'); ?>" alt="arrow"/> <!-- use this is in cms block --> <img src="{{skin url='images/coolerimage.png'}}" alt="" />