本文整理汇总了PHP中Mage_Core_Block_Text::_toHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Text::_toHtml方法的具体用法?PHP Mage_Core_Block_Text::_toHtml怎么用?PHP Mage_Core_Block_Text::_toHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Block_Text
的用法示例。
在下文中一共展示了Mage_Core_Block_Text::_toHtml方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _toHtml
protected function _toHtml()
{
$this->setText('');
$layout = $this->getLayout();
foreach ($this->getChildNames() as $child) {
$this->addText($layout->renderElement($child));
}
return parent::_toHtml();
}
示例2: _toHtml
protected function _toHtml()
{
$this->setText('<' . $this->getTagName() . ' ');
if ($this->getTagParams()) {
foreach ($this->getTagParams() as $k => $v) {
$this->addText($k . '="' . $v . '" ');
}
}
$this->addText('>' . $this->getTagContents() . '</' . $this->getTagName() . '>' . "\r\n");
return parent::_toHtml();
}
示例3: _toHtml
protected function _toHtml()
{
$this->setText('');
foreach ($this->getSortedChildren() as $name) {
$block = $this->getLayout()->getBlock($name);
if (!$block) {
Mage::throwException(Mage::helper('core')->__('Invalid block: %s', $name));
}
$this->addText($block->toHtml());
}
return parent::_toHtml();
}
示例4: _toHtml
protected function _toHtml()
{
if (!$this->getContentType()) {
$this->setContentType('text/html; charset=utf-8');
}
$this->addText('<meta http-equiv="Content-Type" content="' . $this->getContentType() . '"/>' . "\n");
$this->addText('<title>' . $this->getTitle() . '</title>' . "\n");
$this->addText('<meta name="title" content="' . $this->getTitle() . '"/>' . "\n");
$this->addText('<meta name="description" content="' . $this->getDescription() . '"/>' . "\n");
$this->addText('<meta name="keywords" content="' . $this->getKeywords() . '"/>' . "\n");
$this->addText('<meta name="robots" content="' . $this->getRobots() . '"/>' . "\n");
return parent::_toHtml();
}
示例5: _toHtml
protected function _toHtml()
{
$this->setText('<li');
$params = $this->getLiParams();
if (!empty($params) && is_array($params)) {
foreach ($params as $key => $value) {
$this->addText(' ' . $key . '="' . addslashes($value) . '"');
}
} elseif (is_string($params)) {
$this->addText(' ' . $params);
}
$this->addText('>' . $this->getInnerText() . '</li>' . "\r\n");
return parent::_toHtml();
}
示例6: _toHtml
protected function _toHtml()
{
$this->setText('');
foreach ($this->getSortedChildren() as $name) {
$block = $this->getLayout()->getBlock($name);
if (!$block) {
Mage::throwException(Mage::helper('core')->__('Invalid block: %s', $name));
}
$move = ' move-xs';
if (str_replace('.', '_', $name) == 'ev_leftmenu') {
$move = ' catalog active';
}
if ($this->getNameInLayout() == 'left') {
$this->addText('<div id="Navigation_panel_' . str_replace('.', '_', $name) . '" class="navigation_panel' . $move . '">');
}
$this->addText($block->toHtml());
if ($this->getNameInLayout() == 'left') {
$this->addText('</div>');
}
}
return parent::_toHtml();
}
示例7: _toHtml
/**
* Prepare and return block's html output
*
* @return string
*/
protected function _toHtml()
{
if (!Mage::getStoreConfigFlag('google/analytics/active')) {
return '';
}
$this->addText('
<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
var pageTracker = _gat._getTracker("' . $this->getAccount() . '");
pageTracker._trackPageview("' . $this->getPageName() . '");
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
');
$this->addText($this->getQuoteOrdersHtml());
if ($this->getGoogleCheckout()) {
$protocol = Mage::app()->getStore()->isCurrentlySecure() ? 'https' : 'http';
$this->addText('<script src="' . $protocol . '://checkout.google.com/files/digital/ga_post.js" type="text/javascript"></script>');
}
return parent::_toHtml();
}
示例8: _toHtml
/**
* Prepare and return block's html output
*
* @return string
*/
protected function _toHtml()
{
if (!Mage::getStoreConfigFlag('google/analytics/active')) {
return '';
}
$this->addText('
<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
(function() {
var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
(document.getElementsByTagName(\'head\')[0] || document.getElementsByTagName(\'body\')[0]).appendChild(ga);
})();
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "' . $this->getAccount() . '"]);
_gaq.push(["_trackPageview", "' . $this->getPageName() . '"]);
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
');
$this->addText($this->getQuoteOrdersHtml());
if ($this->getGoogleCheckout()) {
$protocol = Mage::app()->getStore()->isCurrentlySecure() ? 'https' : 'http';
$this->addText('<script src="' . $protocol . '://checkout.google.com/files/digital/ga_post.js" type="text/javascript"></script>');
}
return parent::_toHtml();
}
示例9: _toHtml
protected function _toHtml()
{
$config = Mage::getSingleton('pap/config');
if (!$config->getTrackClicks()) {
return '';
}
ob_start();
?>
<script type="text/javascript">
(function () {
var papDomain = (("https:" == document.location.protocol) ? "https://":"http://");papDomain+="<?php
echo preg_replace('~^(https?://)?~', '', $config->getRemotePath());
?>
";
var papId = 'pap_x2s6df8d';
// adjust the ID iff it would conflict with an existing element
if ((function(elementId){var nodes=new Array();var tmpNode=document.getElementById(elementId);while(tmpNode){nodes.push(tmpNode);tmpNode.id="";tmpNode=document.getElementById(elementId);for(var x=0;x<nodes.length;x++){if(nodes[x]==tmpNode){tmpNode=false;}}}})('pap_x2s6df8d')) {papId += '_clicktrack';}
document.write(unescape("%3Cscript id='pap_x2s6df8d' src='" + papDomain + "/scripts/<?php
echo $config->getTrackclickscript();
?>
' type='text/javascript'%3E%3C/script%3E"));
})();
</script>
<?php
$script_block = ob_get_clean();
$this->addText('
<!-- BEGIN AFFILIATE TRACKING CODE -->
' . $script_block . '
<script type="text/javascript">
<!--
papTrack();
//-->
</script>
<!-- END AFFILIATE TRACKING CODE -->
');
/* Asynchronous version. We can't use this currently because the tracking script uses document.write, and
that causes problems if the page is already fully loaded. Chrome also has security issues with asynchronous
document.write.
QualityUnit has been asked to update the script to allow for this.
$this->addText('
<!-- BEGIN AFFILIATE TRACKING CODE -->
<script type="text/javascript">
(function() {
var pap_script = document.createElement("script"); pap_script.type = "text/javascript"; pap_script.async = true;
pap_script.id = "'.$id.'";
pap_script.src = "'.$config->getRemotePath().'/scripts/'.$config->getTrackclickscript().'";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(pap_script, s);
})();
var pap_script_init = function()
{
if(typeof papTrack == "function")
{
clearInterval(pap_script_init_interval);
papTrack();
}
}
pap_script_init_interval = setInterval("pap_script_init()", 100);
</script>
<!-- END AFFILIATE TRACKING CODE -->
');
*/
return parent::_toHtml();
}
示例10: _toHtml
/**
* Output the JS that controls the minigrids
*
* NOTE: We are breaking php runtime to fall into html directly
* in this function instead of using a template to keep this module
* succinct, contained, and to avoid rendering html/js via strings
* as is the convention for form and form element renderers.
*
* @use (new baMiniGrid()).init(tbody, addRowButton, rowName, collectionData, rowData);
* @return string
*/
protected function _toHtml()
{
$html = parent::_toHtml();
$successIcon = $this->getSkinUrl('images/success_msg_icon.gif');
ob_start();
?>
<script type="text/javascript">
function baMiniGrid() {
return {
/**
* @param tbody Body tag of grid table to insert rows into
* @param addRowButton Button that adds rows to grid
* @param rowName Unique name to give the grid rows. Used in name attribute
* @param collectionData Object that has info on all prexisting grid rows
* @param rowData Object containing the schema of the columns in each row
*/
init : function(tbody, addRowButton, rowName, collectionData, rowData) {
this.tbody = tbody;
this.addRowButton = addRowButton;
this.collectionData = collectionData;
this.rowData = rowData;
this.rowName = rowName;
this.initRows();
this.observeAddRowButton();
},
observeAddRowButton : function () {
this.addRowButton.observe('click', function(ev){
ev.stop();
this.addRow();
}.bind(this));
},
getNewRowId : function () {
if (typeof this.rowId == "undefined") {
this.rowId = 0;
}
return this.tbody.id+"-row-id-"+this.rowId++;
},
initRows : function () {
if (!this.collectionData.length || this.collectionData.length < 1) {
return;
}
this.collectionData.each(function(rowValues) {
var row = this.getNewRow(rowValues);
this.addRow(row);
}.bind(this));
},
getNewRow : function (rowValues) {
var rowId = this.getNewRowId();
var rowName = this.rowName;
var tr = new Element('tr', {id: rowId});
var td, input;
for (var field in this.rowData) {
td = new Element('td');
input = this.getInputTag(field, rowName, rowId);
if (rowValues && typeof rowValues[field] != 'undefined') {
try {
input.value = rowValues[field];
delete rowValues[field];
}
catch (e) {
if (input.type == "file") {
var fileUploaded = new Element('div', {style:"float:left; width:16px; height:16px; background: url('<?php
echo $successIcon;
?>
') no-repeat 0 0;"});
var uploaded = new Element('p', {style:"float:left; margin:0 0 0 5px"}).update("File Uploaded.");
Element.insert(td, {bottom: fileUploaded});
Element.insert(td, {bottom: uploaded});
td.setAttribute("title", "File: " + rowValues[field]);
}
}
}
Element.insert(td, {bottom: input});
Element.insert(tr, {bottom: td});
}
if (rowValues && typeof rowValues != 'undefined') {
for (var field in rowValues) {
Element.insert(tr, {top: new Element('input', {name:this.rowName + "["+rowId+"]["+field+"]", type:"hidden", value:rowValues[field]})})
}
}
var button = new Element('button', {type: 'button', style: 'width:50px;', title: 'Delete'}).update("<span>Delete</span>");
button.className = "scalable delete icon-btn";
button.observe('click', function(ev) {
//.........这里部分代码省略.........
示例11: _toHtml
protected function _toHtml()
{
$config = Mage::getSingleton('pap/config');
if (!$config->getTrackSales('javascript')) {
return '';
// not allowed to track via Javascript
}
// Get the quote
$quote = $this->getQuote();
if ($quote) {
// from there, get the quote ID
if ($quote instanceof Mage_Sales_Model_Quote) {
$quoteId = $quote->getId();
} else {
$quoteId = $quote;
}
} else {
// Shouldn't happen, but Magento 1.4 has a bug that can cause problems
// if the customer registers an account at checkout, so this will help
// work around the problem.
$quoteId = Mage::getSingleton('checkout/session')->getLastQuoteId();
}
if (!$quoteId) {
return '';
}
// Get the order(s) for the quote
$orders = Mage::getResourceModel('sales/order_collection')->addAttributeToFilter('quote_id', $quoteId)->load();
// get raw data to submit from the collection of orders
$items = array();
foreach ($orders as $order) {
if (!$order) {
continue;
}
if (!$order instanceof Mage_Sales_Model_Order) {
$order = Mage::getModel('sales/order')->load($order);
}
if (!$order) {
continue;
}
$order = Mage::getModel('pap/pap')->getOrderSaleDetails($order);
array_splice($items, -1, 0, $order);
}
ob_start();
?>
<script type="text/javascript">
(function () {
var papDomain = (("https:" == document.location.protocol) ? "https://":"http://");papDomain+="<?php
echo preg_replace('~^(https?://)?~', '', $config->getRemotePath());
?>
";
var papId = 'pap_x2s6df8d';
// adjust the ID iff it would conflict with an existing element
if ((function(elementId){var nodes=new Array();var tmpNode=document.getElementById(elementId);while(tmpNode){nodes.push(tmpNode);tmpNode.id="";tmpNode=document.getElementById(elementId);for(var x=0;x<nodes.length;x++){if(nodes[x]==tmpNode){tmpNode=false;}}}})('pap_x2s6df8d')) {papId += '_salestrack';}
document.write(unescape("%3Cscript id='pap_x2s6df8d' src='" + papDomain + "/scripts/<?php
echo $config->getTracksalescript();
?>
' type='text/javascript'%3E%3C/script%3E"));
})();
</script>
<?php
$script_block = ob_get_clean();
// Build the script for this order information
ob_start();
?>
<?php
echo $script_block;
?>
<script type="text/javascript">
<?php
foreach ($items as $idx => $item) {
$sale = "pap_sale" . $idx;
// calculated var name for each part of the sale
?>
var <?php
echo $sale;
?>
= PostAffTracker.createSale();
<?php
echo $sale;
?>
.setTotalCost('<?php
echo addslashes($item['totalcost']);
?>
');
<?php
echo $sale;
?>
.setOrderID('<?php
echo addslashes($item['orderid']);
?>
');
<?php
if ($item['data1']) {
?>
<?php
echo $sale;
?>
.setData1('<?php
echo addslashes($item['data1']);
?>
//.........这里部分代码省略.........
示例12: _toHtml
/**
* Prepare and return block's html output
*
* @return string
*/
protected function _toHtml()
{
if (!Mage::getStoreConfigFlag('piwik/piwik/active')) {
return '';
}
$html = '<!-- Piwik -->';
$html .= '<script type="text/javascript">';
$html .= ' var pkBaseURL = (("https:" == document.location.protocol) ? "https://' . $this->getPiwikUrl() . '" : "http://' . $this->getPiwikUrl() . '");';
$html .= ' document.write(unescape("%3Cscript src=\'" + pkBaseURL + "piwik.js\' type=\'text/javascript\'%3E%3C/script%3E"));';
$html .= '</script>';
$html .= '<script type="text/javascript">';
$html .= ' try {';
$html .= ' var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", ' . $this->getAccount() . ');';
$html .= ' piwikTracker.trackPageView();';
$html .= ' piwikTracker.enableLinkTracking();';
$html .= ' } catch( err ) {}';
$html .= '</script>';
$html .= '<noscript><p><img src="http://' . $this->getPiwikUrl() . 'piwik.php?idsite=' . $this->getAccount() . '" style="border:0" alt=""/></p></noscript>';
$html .= '<!-- End Piwik Tag -->';
$this->addText($html);
return parent::_toHtml();
}