我的网站有一个新闻编辑器,我正在使用TinyMCE.我希望能够做的是有一个按钮(在TinyMCE编辑器本身之外),我可以单击以扫描textarea以查找任何图像,然后将这些图像列为选项以用于所述新闻文章的缩略图图像.
要了解我的意思,请在此处查看此链接:https://docs.google.com/leaf?id = 0B05m73kzudwPNzUwZjkyNmItYjZkMy00NTdlLTlkNDctOGRhYThjMzNjNTM5&hl = zh_CN
我的问题是document.getElementById('NewsArticle').值在textarea中有文本时没有返回任何内容
另一个潜在的问题是,textarea中显示的不是实际代码,而是图像等,所以我不确定它是否会首先起作用,但是从表单提交后的数据[新闻] [文章]价值重新回到文本中,我想可能有机会.
如果有人知道如何获得tinyMCE textarea的内容或代码,或者有更好的解决方案,我会有兴趣听到
嘿,如果你有以下代码,并想检查我发现的$key匹配Hello,那么true如果变量是,则总是返回比较0.我遇到了一个特殊键的数组,并想知道为什么它没有按预期工作.请参阅此代码以获取示例.
$key = 1;
if ($key != 'Hello') echo 'Hello'; //echoes hello
$key = 2;
if ($key != 'Hello') echo 'Hello'; //echoes hello
$key = 0;
if ($key != 'Hello') echo '0Hello'; //doesnt echo hello. why?
if ($key !== 'Hello') echo 'Hello'; //echoes hello
Run Code Online (Sandbox Code Playgroud)
有谁能解释一下?
我知道如何在Laravel中打印双花括号:@{{ }}.
但是如何打印三重花括号呢?我之前添加@ @的第一个想法是行不通的,Laravel仍然试图解释它.
有没有一种简单的方法可以将大括号编码为HTML实体?
我将Fire-base Notification CRUL Code与Codeigniter集成在一起.有时我会收到错误,但不是所有时间.
我已将下面的代码集成到控制器中
控制器代码
$newDate=Date('m-d-Y H:i:s');
$test_str=$user->us_name. ' Clocked at '.$newDate;
$res = array();
$res['data']['title'] = $user->us_name.' - Clocked In';
$res['data']['is_background'] = "TRUE";
$res['data']['message'] = $test_str;
$res['data']['image'] = 'http://api.androidhive.info/images/minion.jpg';
$res['data']['payload'] = 'individual';
$res['data']['timestamp'] = date('Y-m-d G:i:s');
$res['data']['act_tab'] = 0;
$cur_id1=$this->db->query("Select token from devices")->result();
foreach($cur_id1 as $cur_id) {
$fields = array('to' => $cur_id->token,'data' => $res);
$this->notif_model->sendPushNotification($fields);
}
Run Code Online (Sandbox Code Playgroud)
型号代码
function sendPushNotification($fields) {
// Set POST variables
$url = 'https://fcm.googleapis.com/fcm/send';
$headers = array(
'Authorization: key=MyServerKey',
'Content-Type: application/json'
);
// Open connection …Run Code Online (Sandbox Code Playgroud) 我们希望通过另一个系统中的Magento-API导出/导入可配置产品.对我们来说重要的是可配置产品的价值,如T恤,有3种颜色(红色,绿色和蓝色).
我们使用以下函数接收可配置属性:
public function options($productId, $store = null, $identifierType = null)
{
$product = $this->_getProduct($productId, $store, $identifierType);
if (!$product->getId()) {
$this->_fault('not_exists');
}
$configurableAttributeCollection = $product->getTypeInstance()->getConfigurableAttributes();
$result = array();
foreach($configurableAttributeCollection as $attribute){
$result[$attribute->getProductAttribute()->getAttributeCode()] = $attribute->getProductAttribute()->getFrontend()->getLabel();
//Attr-Code: $attribute->getProductAttribute()->getAttributeCode()
//Attr-Label: $attribute->getProductAttribute()->getFrontend()->getLabel()
//Attr-Id: $attribute->getProductAttribute()->getId()
}
return $result;
}
Run Code Online (Sandbox Code Playgroud)
但是如何使用我们通过上述函数获得的可配置属性中的现有标签/ id来获取该产品中使用的选项(如果可配置属性为"颜色",则为蓝色,绿色,红色)?
答案非常感谢!
蒂姆
我们有一个数据库表,我们管理一系列颜色.在此表中,我们为颜色保存以下属性:
每个值都在一个单独的字段中.我们现在想要实现的是找到最佳匹配颜色,如果您搜索这些值.
用户可以选择他想要搜索哪些颜色模型.我们的第一种方法是使用范围在数据库中搜索这些值(因此,如果用户搜索红色(RGB)的值150,我们将使用查询数据库BETWEEN 100 AND 200.
结果不是很好,因为组合的值总是与搜索它们并找到适当的行时不同.
有没有更好的方法来搜索我们的数据库以获得最佳匹配颜色?
"最佳匹配"的解释:
我们想找到最近的颜色,所以如果我们搜索红色,我们只想要红色.也许可以计算匹配的百分比,这样用户就可以选择是否必须是100%匹配,或者50%是否也可以.
我正在尝试使用jQuery.each函数从选择列表中获取某些选定选项的文本.
我选择了所有选择的选项:$('#IdOfSelect option:selected')
这很好用.
如果我迭代这个jQuery对象,value.text()当我尝试获取单个选项的文本时,我总是得到错误不是函数.
你可以在这里看到这种行为:http://jsfiddle.net/z2nbP/
在Firebug-Console中,项目显示为<option value="10">而不是我的预期[option](如果它是DOM对象).
如何迭代这些选定的选项,尽管可以获得文本?
我们正在构建一个Web应用程序,它将会上传大量图像.哪个是优化这些图像并将其存储在网站上的最佳解决方案?
还有一种方法我可以自动增强正在上传的图像?
有没有办法将onclick-function的返回值confirm转换为jQuery函数?
我有链接,其中有一个onclick事件进行确认,返回true或false:
<a onclick="return confirm('Sure?');" class="delete" href="delete.php">Delete</a>
Run Code Online (Sandbox Code Playgroud)
这是一个给定的结构,我没有可能改变它.但我想做这样的事情:
$('a.delete').click(function() {
if (confirm_from_onclick == true) {
//do some more before really returning true and following the link
}
});
Run Code Online (Sandbox Code Playgroud) 我有两张桌子:用户和公司:
class Firm extends AppModel {
var $name = 'Firm';
var $hasAndBelongsToMany = 'User';
}
Run Code Online (Sandbox Code Playgroud)
和:
class User extends AppModel {
var $name = 'User';
var $hasMany ='Post';
var $hasAndBelongsToMany = 'Firm';
}
Run Code Online (Sandbox Code Playgroud)
我使用scaffold var来显示所有保存/查看/编辑等方法.我重写了这样的add方法:
function add(){
if (!empty($this->data)) {
$this->User->create();
$this->User->save($this->data);
$this->redirect(array('action'=>'index'), null, true);
}
$firms = $this->User->Firm->find('list');
$this->set('firms', $firms);
}
Run Code Online (Sandbox Code Playgroud)
一切都很好,但当我使用用户/添加时,我得到了ID为"1","2"等的下拉列表.
我想显示公司名称,而不是ID.怎么做?
我想这样做,以便在关闭jQuery UI对话框时focus触发文档的事件.每当对话框关闭时,最好不要将每个对话框绑定到页面本身.
我怎样才能做到这一点?
我有一个路由器的控制器Route::controller().
我有getEdit一个postEdit功能.我正在链接到getEdit来自不同位置的-function,并希望在表单中进行更改并提交后将用户重定向到该位置.
我Redirect::back()成功保存到数据库后使用了该方法,但不幸的是我没有被重定向到请求的页面BEFORE getEdit,而是返回到getEdit.
我是否有可能改变这种行为?
php ×4
jquery ×3
api ×2
javascript ×2
algorithm ×1
blade ×1
cakephp ×1
codeigniter ×1
colors ×1
configurable ×1
dialog ×1
if-statement ×1
image ×1
iterator ×1
jquery-ui ×1
laravel ×1
laravel-4 ×1
magento ×1
mysql ×1
onclick ×1
optimization ×1
select ×1
tinymce ×1
view ×1