I'm passing a url string variable from a controller to a phtml file where i'd like to then display it as a hyperlink.
unfortunately, magento seems to prefix the variable data with the controller's url.
so a variable that's passed like this www.something.com is converted to www.mydomain.com/my_controller/www.something.com when calling this in the phtml to create a hyperlink.
<?php echo "<a href='" . $this->myVar . "'>html link in php</a><p>";?>
if i make a simple call this, it displays the text correctly:
<?php echo $this->myVar?>
i've tried calling this to strip the added url:
$newURL = str_replace("www.mydomain.com/my_controller/", "", $this->myVar, $count);
but php doesn't seem to find the substring and count = 0.
seems like magento is adding the controller's url automatically
, which is not what i need.
this is how i'm rendering the page.
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
$block = $this->getLayout()->createBlock(
'Mage_Core_Block_Template',
'blockname',
array('template' => 'NamespaceName_ModuleName/links.phtml')
)
->setData('var', 'www.something.com');
$this->getLayout()->getBlock('content')->append($block);
$this->_initLayoutMessages('core/session');
$this->renderLayout();
Any ideas?