How to parse and process HTML/XML in PHP

Simple HTML DOM is a great open-source parser: simplehtmldom.sourceforge It treats DOM elements in an object-oriented way, and the new iteration has a lot of coverage for non-compliant code. There are also some great functions like you’d see in JavaScript, … Read More

Access a variable declared in a phtml from another phtml in Magento2

posted in: Design, HTML, PHP, Programming, XML 0

Having two blocks in the catalog_product_view.xml file like this: To access a variable declared in the first block from the second block, you can set the variable with register from the first phtml, then you get the value in the … Read More

Resize an image with the same aspect ratio or with custom and crop sizes in PHP

posted in: PHP, Programming 0

In this article, I will explain how to resize an image in two different ways resizing with custom dimensions keeping the same proportions/aspect ratio Method 1: Resizing with custom dimensions The most practical method in PHP to resize an image … Read More

How to use Associative Arrays in ASP

First of all, You need to download the “Asp Associative Array class” then include the file “AssociativeArrayClass.asp” in your asp page. Right now, You can start declaring associative arrays in ASP with the following syntax: [sourcecode language=”vb”] Dim Person Set … Read More

VBScript Class to create easly Associative Arrays in ASP like in PHP

I’ve posted a project at Source Forge with an ASP/VBScript class to create easly associative arrays like in PHP; visit http://sourceforge.net/projects/asp-assoc-array/ It is possible also load in an associative-array the data coming from MySQL or MS Access databases, then You … Read More

PHP Date or Datetime to MySQL Datetime and viceversa

Two useful PHP functions to convert normal date/datetime (“25.12.2010 12:10:00” or “25.12.2010”) to MySQL datetime (like “2010-12-25 12:10:00” or “2010-12-25 00:00:00″); You can get back a date/datetime from MySQL datetime too: [sourcecode language=”php”] function datetime2mysqldatetime($datetime){ // ‘25.12.2010 12:10:00’ -> ‘2010-12-25 … Read More

Easy-to-use and strong Encrypt/Decrypt PHP functions

posted in: Cryptography, PHP, Programming 1

I wrote those two following PHP functions to encrypt and decrypt strings easly and with a stronger encryption module than the other examples on the net (please, note that “strong” does not equals “secure”!); Happy encryption/decryption! 🙂 Max [sourcecode language=”php”] … Read More