我已經建立了一個變量(horaires_lundi)在該文件中:Magento:很好地顯示在JavaScript中的變量。如何在同一個文件中的PHP調用它?
應用程序/代碼/社區/ Unirgy/StoreLocator /控制器/ Adminhtml/Locationcontroller.php
->setTitle($this->getRequest()->getParam('title'))
->setNotes($this->getRequest()->getParam('notes'))
->setStreetAddress($this->getRequest()->getParam('street_address'))
->setHorairesLundi($this->getRequest()->getParam('horaires_lundi'))
所有變量都
應用程序/設計/前端/預設/默認/模板/ unirgy/storelocator/map.phtml
:在這個文件中也顯示在JavaScript在JavaScript
(function(){
var storeLocator = new UnirgyStoreLocator({
mapEl: $('map'),
sidebarEl: $('sidebar'),
searchUrl: '<?php echo $this->getUrl('ustorelocator/location/search')?>',
generateSidebarHtml: function(m) {
return '<span style="font-size:14px; color:#C68804;"><b>' + m.title + '</b></span><br/>(Distance : ' + parseFloat(m.distance).toFixed(1) + ' ' + m.units + ')<br/>'
+ m.street_address + ' ' + m.test + ' ' + m.city + '<br/><b>' + m.notes + '</b><br/>';
},
generateMarkerHtml: function(m) {
var url = m.website_url.replace(/\s/,'');
var dataForm = new VarienForm('form-validate', true);
return '<span style="font-size:14px; color:#C68804;">' + m.title + '</span><br/>'
+ '<?php if (trim($this->getHorairesLundi())!=""): ?>Lun '+ m.horaires_lundi +'<?php else : ?>No horaire lundi<br/><?php endif; ?>'
可變m.horaires_lundi
公顯示在前端。 但我不能在PHP中的狀態顯示m.horaires_lundi
只有m.horaires_lundi
存在......
上面我與
<?php if (trim($this->getHorairesLundi())!=""): ?>
它是一個goog方法一試?我還需要做什麼? 是否有其他方法的東西,如:
<?php if (Mage::helper(...
我發現一個關於Magento的教程,但找不到我的解決方案。
下一次,請4位(使用'code'按鈕)縮進代碼;那麼你也不必使用這些點來顯示php標籤。 – 2010-06-26 17:48:28