<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Agence de Développement Informatique du Nord &#187; block</title>
	<atom:link href="http://blog.adin.pro/tag/block/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.adin.pro</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 26 Dec 2019 08:54:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>Magento &#8211; edit breadcrumb from block</title>
		<link>http://blog.adin.pro/2016-10-27/magento-edit-breadcrumb-from-block/</link>
		<comments>http://blog.adin.pro/2016-10-27/magento-edit-breadcrumb-from-block/#comments</comments>
		<pubDate>Thu, 27 Oct 2016 12:22:13 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[breadcrumb]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=530</guid>
		<description><![CDATA[<p>To edit a breadcrumb from the block, you can simply do that : $_mainOrder is defined in the __contruct() function</p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2016-10-27/magento-edit-breadcrumb-from-block/">Magento &#8211; edit breadcrumb from block</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>To edit a breadcrumb from the block, you can simply do that :</p>
<pre class="brush: php; title: ; notranslate">
class Adin_Sales_Block_Invoice_View extends Mage_Core_Block_Template
{

    private $_mainOrder;

    public function _prepareLayout()
    {
        if ($breadcrumbs = $this-&gt;getLayout()-&gt;getBlock('breadcrumbs')) {
            $breadcrumbs-&gt;addCrumb('All orders', array('label'=&gt;$this-&gt;__('All my invoices'), 'title'=&gt;$this-&gt;__('All my invoices'), 'link'=&gt;$this-&gt;getUrl('sales/invoice/history')));
            $breadcrumbs-&gt;addCrumb('My order', array('label'=&gt;$this-&gt;__('My invoices : order %s', $this-&gt;_mainOrder-&gt;getIncrementId()), 'title'=&gt;$this-&gt;__('My invoices : order %s',$this-&gt;_mainOrder-&gt;getIncrementId()), ));
        }
        return parent::_prepareLayout();
    }
</pre>
<p>$_mainOrder is defined in the __contruct() function</p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2016-10-27/magento-edit-breadcrumb-from-block/">Magento &#8211; edit breadcrumb from block</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2016-10-27/magento-edit-breadcrumb-from-block/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento add block into cms page and add permissions</title>
		<link>http://blog.adin.pro/2016-02-25/magento-add-block-into-cms-page-and-add-permissions/</link>
		<comments>http://blog.adin.pro/2016-02-25/magento-add-block-into-cms-page-and-add-permissions/#comments</comments>
		<pubDate>Thu, 25 Feb 2016 15:38:37 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[cms page]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[whitelist]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=513</guid>
		<description><![CDATA[<p>If you want to add a block into cms page, you just have to add this into its content Of course, don&#8217;t forget to create the block class app/code/local/Adin/Page/Block/Page/Html/Combos.php and the .phtml file app/design/frontend/adin/default/template/page/html/combos.phtml But when you want to render &#8230; <a href="http://blog.adin.pro/2016-02-25/magento-add-block-into-cms-page-and-add-permissions/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2016-02-25/magento-add-block-into-cms-page-and-add-permissions/">Magento add block into cms page and add permissions</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>If you want to add a block into cms page, you just have to add this into its content</p>
<pre class="brush: xml; title: ; notranslate">
{{block type=&quot;adin_page/page_html_combos&quot; name=&quot;combos&quot; template=&quot;page/html/combos.phtml&quot;}} 
</pre>
<p>Of course, don&#8217;t forget to create the block class app/code/local/Adin/Page/Block/Page/Html/Combos.php</p>
<pre class="brush: php; title: ; notranslate">
class Adin_Page_Block_Page_Html_Combos extends Mage_Core_Block_Template
{
//...
}
</pre>
<p>and the .phtml file<br />
app/design/frontend/adin/default/template/page/html/combos.phtml</p>
<p>But when you want to render the page, nothing.<br />
On the logs (system.log), you have : Security problem: adin_page/page_html_combos has not been whitelisted.<br />
It&#8217;s a new feature since securoty Patch SUPEE-7405 and Magento CE 1.9.2.2, you have to add your block into whitelist. You can do it manually, in backoffice, System > Permissions > Blocks or do it programmatically :</p>
<pre class="brush: php; title: ; notranslate">
$blockNames = array(
    'adin_page/page_html_combos'
);
foreach ($blockNames as $blockName) {
    $whitelistBlock = Mage::getModel('admin/block')-&gt;load($blockName, 'block_name');
    $whitelistBlock-&gt;setData('block_name', $blockName);
    $whitelistBlock-&gt;setData('is_allowed', 1);
    $whitelistBlock-&gt;save();
}
</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2016-02-25/magento-add-block-into-cms-page-and-add-permissions/">Magento add block into cms page and add permissions</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2016-02-25/magento-add-block-into-cms-page-and-add-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento &#8211; add something in the header section</title>
		<link>http://blog.adin.pro/2015-10-21/magento-add-something-in-the-section/</link>
		<comments>http://blog.adin.pro/2015-10-21/magento-add-something-in-the-section/#comments</comments>
		<pubDate>Wed, 21 Oct 2015 07:53:04 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=503</guid>
		<description><![CDATA[<p>If you need to add something in the header section of all your pages, you can go on your template and add it to the files 1column.phtml, 2columns-left.phtml, 2columns-right.phtml&#8230; You can, but you shouldn&#8217;t, it&#8217;s not a good practice. Let&#8217;s &#8230; <a href="http://blog.adin.pro/2015-10-21/magento-add-something-in-the-section/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2015-10-21/magento-add-something-in-the-section/">Magento &#8211; add something in the header section</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>If you need to add something in the header section of all your pages, you can go on your template and add it to the files 1column.phtml, 2columns-left.phtml, 2columns-right.phtml&#8230; You can, but you shouldn&#8217;t, it&#8217;s not a good practice.</p>
<p>Let&#8217;s see the content of one of this file</p>
<pre class="brush: php; title: ; notranslate">
&lt;head&gt;
&lt;?php echo $this-&gt;getChildHtml('head') ?&gt;
&lt;/head&gt;
</pre>
<p>You can see the <head> section will be filled with all &#8220;head&#8221; child block, so let&#8217;s create one.</p>
<p>On your layout file (design/frontend/adin/default/layout/adin_page.xml), add the declaration of your new block</p>
<pre class="brush: xml; title: ; notranslate">
&lt;layout version=&quot;0.1.0&quot;&gt;
    &lt;default&gt;
        &lt;reference name=&quot;head&quot; before=&quot;-&quot;&gt;
            &lt;block type=&quot;adin_page/headerstuff&quot; name=&quot;headerstuff&quot; as=&quot;headerstuff&quot; template=&quot;page/html/headerstuff.phtml&quot; /&gt;
        &lt;/reference&gt;
   &lt;/default&gt;
&lt;/layout&gt;
</pre>
<p>Create the block class in app/code/local/Adin/Page/Block/Headerstuff.php</p>
<pre class="brush: php; title: ; notranslate">
class Adin_Page_Block_Headerstuff extends Mage_Core_Block_Template
{
    public function _construct()
    {
    }
}
</pre>
<p>And create you template file app/design/frontend/adin/default/template/page/html/headerstuff.phtml</p>
<pre class="brush: php; title: ; notranslate">
&lt;!-- header my stuff to put in the header --&gt;
</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2015-10-21/magento-add-something-in-the-section/">Magento &#8211; add something in the header section</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2015-10-21/magento-add-something-in-the-section/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento load template from controller</title>
		<link>http://blog.adin.pro/2015-02-11/magento-load-template-controller/</link>
		<comments>http://blog.adin.pro/2015-02-11/magento-load-template-controller/#comments</comments>
		<pubDate>Wed, 11 Feb 2015 09:49:05 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=451</guid>
		<description><![CDATA[<p>To load html content of a template inside a controller, for example for ajax response, you can do :</p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2015-02-11/magento-load-template-controller/">Magento load template from controller</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>To load html content of a template inside a controller, for example for ajax response, you can do :</p>
<pre class="brush: php; title: ; notranslate">
$block = $this-&gt;getLayout()-&gt;createBlock('adin_admin/adminhtml_scheduletcrender')-&gt;setTemplate('admin/scheduletcrender.phtml');
$block-&gt;assign(array('ateliers' =&gt; $ateliers));
$html = $block-&gt;toHtml();
$response = array('html' =&gt; $html);
     
//send response as json
$this-&gt;getResponse()-&gt;setHeader('Content-type', 'application/json');
$this-&gt;getResponse()-&gt;setBody(Mage::helper('core')-&gt;jsonEncode($response));
</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2015-02-11/magento-load-template-controller/">Magento load template from controller</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2015-02-11/magento-load-template-controller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento render cms/block with widgets</title>
		<link>http://blog.adin.pro/2014-10-15/magento-render-cmsblock-with-widgets/</link>
		<comments>http://blog.adin.pro/2014-10-15/magento-render-cmsblock-with-widgets/#comments</comments>
		<pubDate>Wed, 15 Oct 2014 08:39:25 +0000</pubDate>
		<dc:creator><![CDATA[blogadmin]]></dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://blog.adin.pro/?p=422</guid>
		<description><![CDATA[<p>You create a cms static block (cms/block) and dynamise it with widget, here an example: You then render this block : But the widget {{skin url=&#8217;images/image-order.jpg&#8217;}} is not executed and is display as {{skin url=&#8217;images/image-order.jpg&#8217;}}. To execute the widget, you &#8230; <a href="http://blog.adin.pro/2014-10-15/magento-render-cmsblock-with-widgets/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2014-10-15/magento-render-cmsblock-with-widgets/">Magento render cms/block with widgets</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>You create a cms static block (cms/block) and dynamise it with widget, here an example:</p>
<pre class="brush: xml; title: ; notranslate">
 &lt;div class=&quot;confirmation&quot;&gt;
        &lt;img src=&quot;{{skin url='images/image-order.jpg'}}&quot; alt=&quot;&quot; /&gt;
 &lt;/div&gt;
</pre>
<p>You then render this block :</p>
<pre class="brush: php; title: ; notranslate">
echo Mage::getModel('cms/block')
            -&gt;setStoreId(Mage::app()-&gt;getStore()-&gt;getId())
            -&gt;load(self::confirmationCmsBlockName)-&gt;render();
</pre>
<p>But the widget {{skin url=&#8217;images/image-order.jpg&#8217;}} is not executed and is display as {{skin url=&#8217;images/image-order.jpg&#8217;}}.</p>
<p>To execute the widget, you need to render as HTML a block and not a model</p>
<pre class="brush: php; title: ; notranslate">
echo  Mage::app()-&gt;getLayout()-&gt;createBlock('cms/block')-&gt;setBlockId(self::confirmationCmsBlockName)-&gt;toHtml();
</pre>
<p>The post <a rel="nofollow" href="http://blog.adin.pro/2014-10-15/magento-render-cmsblock-with-widgets/">Magento render cms/block with widgets</a> appeared first on <a rel="nofollow" href="http://blog.adin.pro">Agence de Développement Informatique du Nord</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.adin.pro/2014-10-15/magento-render-cmsblock-with-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
