Home » Archive

Articles tagged with: XML

Magento »

[17 Aug 2015 | No Comment]

You can put IF condition in Layout XML file of Magento to show or hide any block. The IF condition checks for the Yes/No value of configuration settings.
Suppose, you have a custom module. You have a custom block that you want to show in left and right sidebar. You have two Yes/No configuration settings to show/hide the custom block on left sidebar and right sidebar.

Magento »

[3 Aug 2015 | No Comment]

You can add custom blocks inside already existing block through your custom layout xml file. You don’t need to change the template (phtml) code.
Suppose, you want to add a block inside product view page. To do so, you can write the following xml code in your custom module’s layout file. In the below code, I have added a button in product view page.

Magento, XML »

[17 Feb 2010 | One Comment]

Here, I will be showing you how you can read XML nodes from config.xml file of your module. It’s through the Magento way with Mage::getConfig()->getNode() function. :)
Here is the XML code of my config.xml file. I will be reading the nodes of this XML file.

Magento, XML »

[17 Feb 2010 | 9 Comments]

I will be using Varien_Simplexml_Element class to read write xml nodes. The path to this class file is lib/Varien/Simplexml/Element.php
Here is a sample XML file which I am going to read through Magento code. I will also be adding an XML node to the following XML data.

Magento »

[16 Feb 2010 | 5 Comments]

I was building a custom module in Magento. I had created a system.xml file for storing configuration data from admin. From the below system.xml file, you can see that I have created a section named ‘My Module Name‘ which can be accessed from Admin –> System –> Configuration.
In the file below, I have just displayed the section and groups name. I have omitted others fields with dots, as they are not necessary here.

PHP, XML »

[23 Oct 2009 | 2 Comments]

In this article, I will be showing you how to create and read xml document with php’s DOMDocument.
The DOM extension allows you to operate on XML documents through the DOM API with PHP 5.
Below is the code to create XML file. I have named the output file ‘example.xml’. For better understanding, I have written comment for almost every line of code.

PHP, XML »

[23 Oct 2009 | 2 Comments]

In this article, I will be showing you how to create and read xml document with php’s SimpleXML extension.
The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators.