Posts Tagged ‘admin’

Hello,

Magento Core, Admin Static Blocks, CMS Page, or Phtml edits are usually includes getting url path such images, javascript, base url, media and store url. There are different ways to retrieve mentioned URL paths depending on where section you’re editing.

For Eg: {{skin url=’images/sampleimage.jpg ‘}}, {{media url=’/sampleimage.jpg’}}, {{store url=’mypage.html’}}

We can also use the above ways in our custom modules Content/Textarea field values. I know one question arise in your mind that “How will it display in frontend?”.

I am here to show you how can we display its content in frontend. We will create One function in block file.



public function processHtml($content)
{

        /* @var $helper Mage_Cms_Helper_Data */
        $helper = Mage::helper('cms');
        $processor = $helper->getPageTemplateProcessor();
        $html = $processor->filter($content);
        return $html;
}


Lets say your textarea field name of your module is ‘content’ you can display content like:


<?php echo $object->getContent(); ?>

//Instead of above code, you need to use below code to display


<?php echo $this->processHtml($object->getContent());?>

I hope above content is useful to you. Thanks for reading my blog.

Thanks,
Bijal Bhavsar 🙂

Usind that we can get currently logged in admin details.


$d = Mage::getSingleton('admin/session')->getData();
$dm = $d['user']->getData();

For getting currently logged in admin email id.

$adminEmail = $dm['email'];

Thanks,
Bijal Bhavsar 🙂