如何在管理面板/目录/管理产品/标签中获取当前产品ID?
我有一个自定义产品标签,不知道如何获取当前的产品ID.
在前端我会做这样的事情:
<?php $_product = $this->getProduct(); ?>
<?php echo $_product->getId() ?>
Run Code Online (Sandbox Code Playgroud) 我需要这个:
输入
<div>some text [img]path_to_image.jpg[\img]</div>
<div>some more text</div>
<div> and some more and more text [img]path_to_image2.jpg[\img]</div>
Run Code Online (Sandbox Code Playgroud)
产量
<div>some text <img src="path_to_image.jpg"></div>
<div>some more text</div>
<div>and some more and more text <img src="path_to_image2.jpg"></div>
Run Code Online (Sandbox Code Playgroud)
这是我的尝试,也失败了
var input = "some text [img]path_to_image[/img] some other text";
var output = input.replace (/(?:(?:\[img\]|\[\/img\])*)/mg, "");
alert(output)
//output: some text path_to_image some other text
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!
这是代码的一部分:
inprogress = false;
function getid(id) {
return document.getElementById(id);
}
var uploader = new plupload.Uploader({
runtimes : 'gears,html5,flash,silverlight,browserplus',
browse_button : 'link-browse',
max_file_size : '100mb',
url : 'site/upload/process.php?dir=<?php echo $uplid; ?>',
flash_swf_url : 'site/upload/plupload.flash.swf',
silverlight_xap_url : 'site/upload/plupload.silverlight.xap',
});
uploader.bind('Init', function(up, params) {
//$('filelist').innerHTML = "<div>Current runtime: " + params.runtime + "</div>";
});
uploader.bind('FilesAdded', function(up, files) {
if(uploader.files.length <= 0){
var element = document.getElementById('standby');
element.parentNode.removeChild(element);
}
if(up.files.length > 4 || uploader.files.length > 4)
{
alert('Only 5 files per upload !');
return false; …
Run Code Online (Sandbox Code Playgroud) 我想在Magento CMS Pages中包含外部PHP脚本
例如
**http://myhost/magento/custom/script.php**
<?php echo "hello"; ?>
Run Code Online (Sandbox Code Playgroud)
Magento Page的结果应为:" hello
"
最简单的方法是什么?
我有一个php文件:
<?php
$a = 1;
function test(){
echo $a;
}
test();
?>
Run Code Online (Sandbox Code Playgroud)
我收到这个错误:
Notice: Undefined variable: a in X:\...\test.php on line 4
Run Code Online (Sandbox Code Playgroud)
使用XAMPP @ 32bit W7.
我正在尝试开发一个简单的基于php的计划...
这是我的数据库表:
假设当前时间/日期是: 2012-03-21 02:00:00
PHP脚本应该回应: Meeting 2
我有一部分脚本,但不知道接下来该做什么
<?php
$con = mysql_connect("localhost","root","");
if (!$con){die('Could not connect: ' . mysql_error());}
mysql_select_db("schedule", $con);
$current_time = date("Y-m-d H:i:s");
$result = mysql_query("SELECT * FROM events");
while($row = mysql_fetch_array($result)){
echo $row['Subject'];
}
mysql_close($con);
?>
Run Code Online (Sandbox Code Playgroud)
如何过滤查询,到当前时间和预定主题?谢谢!
(如果current_time
介于StartTime
和之间EndTime
- - 回显它Subject
)
我很难理解如何读取包含"@attributes"的JSON对象.
Javascript:
$.ajax({
type: "GET",
dataType: 'json',
url: "http://..../script/weather.php?r="+req,
success: function(data){
alert(data.weather.forecast_information.city[0].data)
}
});
Run Code Online (Sandbox Code Playgroud)
JSON响应:
{
"@attributes": {
"version": "1"
},
"weather": {
"@attributes": {
"module_id": "0",
"tab_id": "0",
"mobile_row": "0",
"mobile_zipped": "1",
"row": "0",
"section": "0"
},
"forecast_information": {
"city": {
"@attributes": {
"data": "Kreuzlingen, Thurgovia"
}
},
"postal_code": {
"@attributes": {
"data": "kreuzlingen"
}
},
"latitude_e6": {
"@attributes": {
"data": ""
}
},
"longitude_e6": {
"@attributes": {
"data": ""
}
},
"forecast_date": {
"@attributes": {
"data": …
Run Code Online (Sandbox Code Playgroud) 使用jQuery v1.6.4,
我正在尝试动态格式化一些对象.
这是我的代码:
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
style = {'color':'#F30', 'font-size':'20px'};
/* example:1 - not working */
for(attr in style) $('.text').css({attr:style[attr]});
/* example:2 -works */
//$('.text').css({'color':style['color']}).css({'font-size':style['font-size']});
})
</script>
</head>
<body>
<div class="text">This is the text.</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
为什么示例1不起作用?还有其他方法吗?
Chrome控制台不会显示任何错误.对象"样式"将形成JSON,因此我尝试优化代码,而不是手动编写每个样式,如第二个示例.
感谢您的任何帮助.
这是我的代码:
HTML
<div class="popup">
<div class="popup-frame">
<div class="popup-cont">
<div class="inner"></div>
</div>
</div>
<div class="bg"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS
s.popup = {
set : function(e){
if(e) $.get(s.v+e+'.php', function(e){$('.popup .inner').append(e).parent().parent().parent().show()})
else $('.popup .inner').empty().parent().parent().parent().hide();
}
}
Run Code Online (Sandbox Code Playgroud)
想法是:如果(e)
.popup .inner
.popup
其他
.popup .inner
.popup
题
有没有更好的方式来选择.popup
比
.parent().parent().parent()
附加:我知道这可以这样做:
$('.popup .inner').empty(); $('.popup').hide();
Run Code Online (Sandbox Code Playgroud) 此脚本应检测完整路径中的最后一部分,以及是否stackoverflow
输出ok
$current_url = $_SERVER['REQUEST_URI'];
$current_url_arr = explode('/',$current_url);
$count = count($current_url_arr);
if($current_url_arr[$count-2] == 'stackoverflow'){
echo 'ok';
}
else {
echo 'not ok';
}
Run Code Online (Sandbox Code Playgroud)
示例1:www.myserver.ext/something/else/stackoverflow/
输出:ok
示例2:www.myserver.ext/something/else/stackoverflow
输出:not ok
例3:www.myserver.ext/something/else/stackoverflow/foo
输出:not ok
我希望你理解这个想法.这个脚本工作正常,但我想知道是否有更好,更优雅的方式来读取URL的最后部分?
我有一个非常基本的问题.为什么这不起作用?!
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="1000" height="550" minWidth="960" backgroundColor="#F2F0F0">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Label id="test1" x="43" y="259" text="Label"/>
<fx:Script>
<![CDATA[
test1.text = "Yay! This works...!";
]]>
</fx:Script>
</s:Application>
Run Code Online (Sandbox Code Playgroud)
我收到此错误:访问未定义的属性.
谢谢!
例如:
Dir结构
localhost/
|- test/
|- index.php
|- .htaccess
Run Code Online (Sandbox Code Playgroud)
index.php:
<?php
if(isset($_GET['cmd'])){
echo "cmd is ok";
}
?>
Run Code Online (Sandbox Code Playgroud)
的.htaccess
RewriteEngine On
RewriteRule ^([^/]*)/$ /test/index.php?cmd=$1 [L]
Run Code Online (Sandbox Code Playgroud)
如果用户设置: http://localhost/test/index.php?cmd=a
输出将是: cmd is ok
那没问题!
如果用户设置,我想得到相同的结果http://localhost/test/a
应该如何设置.htaccess/mod_rewrite?
有了代码,我只得到404.
php ×5
javascript ×3
jquery ×3
magento ×2
string ×2
.htaccess ×1
actionscript ×1
apache ×1
apache-flex ×1
calendar ×1
css ×1
datetime ×1
html ×1
json ×1
limit ×1
mod-rewrite ×1
mysql ×1
parent ×1
plupload ×1
regex ×1
replace ×1
search ×1
selector ×1
upload ×1
url ×1
url-parsing ×1
variables ×1
xml ×1