I need to change the url of ui_template in the dasboard of node-red.
If I write something like:
<iframe src="https://online.wonderware.eu/s/l5kctp/Explore/Analysis/loquesea/Embed"></iframe>
I can see:
If I try to send the url using the msg.payload y can see:
I tried to get the payload with the next code:
<iframe src={{msg.payload}}></iframe>
And the payload is:
msg.payload="https://online.wonderware.eu/s/l5kctp/Explore/Analysis/loquesea/Embed";
I tried a lot of sintaxis to read the payload but I can not read it correctly.
Do you know How Can I read the payload and change the ui_template url?
Thanks
Try using template node in front of the ui_template. You want to use three curly brackets to escape the HTML.
<iframe src={{{payload}}}></iframe>
[{"id":"8fbf7029.588de","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"dc2dd6a.d014628","type":"inject","z":"8fbf7029.588de","name":"","topic":"","payload":"http://localhost:1880","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"0.5","x":230,"y":220,"wires":[["35a71b83.0fda04"]]},{"id":"c1cf74f3.655238","type":"ui_template","z":"8fbf7029.588de","group":"d2702cb6.ab449","name":"","order":0,"width":"22","height":"12","format":"","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":600,"y":220,"wires":[[]]},{"id":"35a71b83.0fda04","type":"template","z":"8fbf7029.588de","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<iframe src={{{payload}}}></iframe>","output":"str","x":420,"y":220,"wires":[["c1cf74f3.655238"]]},{"id":"d2702cb6.ab449","type":"ui_group","z":"","name":"G1","tab":"223c13e7.70f2cc","disp":true,"width":"22","collapse":false},{"id":"223c13e7.70f2cc","type":"ui_tab","z":"","name":"T1","icon":"dashboard","disabled":false,"hidden":false}]
You need some quotes in the template:
<iframe src="{{msg.payload}}"></iframe>
That should work.
The following flow works as a demo:
[{"id":"73ac3c27.dcfd64","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"28b66011.fbc02","type":"ui_tab","z":"","name":"Home","icon":"dashboard"},{"id":"99b10eed.f26b","type":"ui_group","z":"","name":"Default","tab":"28b66011.fbc02","disp":true,"width":"6"},{"id":"54e8a488.88e8bc","type":"inject","z":"73ac3c27.dcfd64","name":"","topic":"","payload":"http://localhost:1880","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":200,"y":220,"wires":[["2823261f.a736ea"]]},{"id":"2823261f.a736ea","type":"ui_template","z":"73ac3c27.dcfd64","group":"99b10eed.f26b","name":"","order":0,"width":0,"height":0,"format":"\n<iframe src=\"{{msg.payload}}\"></iframe>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":420,"y":240,"wires":[[]]}]
Related
Using Spring / Thymeleaf i18n, I'd like to create a HTML paragraph message like "Click here", in which there is a link only for the word "here". What is the best way to do this?
The way I tried doesn't look nice and also results in a like break:
In messages.properties file:
error.generic.click=Click
error.generic.here=here
And in the HTML file:
<p th:text="#{error.generic.click}"></p><p><a th:text="#{error.generic.here}" th:href="#{/contact}"></a></p>
Answer
Your way seems okay to me. If you just want to fix the newline issue go ahead with the following one:
<p>
<span th:text="#{error.generic.click}"></span>
<a th:text="#{error.generic.here}" th:href="#{/contact}"></a>
</p>
The span will make "Click" stay on the same line as "here". However i'd just go for a link that say "Click here" instead of just "here".
For example in german you could say "Hier klicken". "Hier" would mean "here" and "klicken" would mean "click". The Problem is that the meaning for the words changed but the position didn't. You would end up with a link saying "klicken" instead of "Hier".
Not recommented
There is another approach, but it has some drawbacks. You could use:
<p th:utext="#{error.generic}"></p>
with the following messages.properties:
error.generic=Click here
The drawback on this one is that you can't use th:href anymore. I would not recomment this way. However this can be helpfull when using no th:* and just plain html tags. So i wanted to mention it.
Loading image using variable containing base64 data in AngularJS
I am trying to find the right way to load a image source from a variable containing base64 encoded image data (for example pulled from a canvas using toDataURL(); ).
At first I just tried it like this:
<img src="{{image.dataURL}}" />
where the image is a scope variable with a variable dataURL containing the base64 data. This is actually working pretty well, the only problem is that I get a 404 error in my console. Something like this:
GET http://www.example.com/%7B%7Bimage.dataURL%7D%7D 404 (Not Found)
Not so pretty. When I tried a more angular style solution like this:
<img data-ng-src="image.dataURL" />
the images are not loading at all.
I made a fiddle which you can find HERE
Any suggestions how to get rid of this error in my console?
EDIT:
Gruff Bunny was right. This <img data-ng-src="{{image.dataURL}}" /> is working...
Working solution can be found HERE
The content of the ng-src needs to be interpolated: Try this:
<img data-ng-src="{{image.dataURL}}"/>
I admit I spent way too much time trying to fix similar problem,
my problem was I had extra brace here (see three braces at end):
ng-attr-src="{{aad.form.imageBase64Temp}}}"
I would like to know if there is a plugin in order to insert HTML codes in a CKEditor textarea?
I tried to install the PBCKCode plugin but it doens't work because the HTML is executed in my textarea.
Anthony
EDIT1 ----- INSERTPRE Plugin -------
Query when I add the post :
INSERT INTO `Posts` (`slug`,`title`,`thumbnail`,`content`,`tags`,`state`,`click`,`createdAt`,`updatedAt`,`id`) VALUES ('dsq','dsq','http://4.bp.blogspot.com/-knCgLUMOkJc/TeMY2jkmACI/AAAAAAAAAV0/VByHmoMa2N8/s1600/first+blog+posting.jpg','<pre class="prettyprint">\r\n<div>toto</div></pre>\r\n\r\n<p>dqsdqs</p>\r\n','toto','0',0,'2013-04-30 12:15:46','2013-04-30 12:15:46',NULL);
The result in my textarea when I try to edit the post :
<pre class="prettyprint">
</pre>
<div>toto</div>
<p>dqsdqs</p>
As you can see the "div" have changed of place.
EDIT2 ----- Escape HTML -------
Screenshot : http://grab.by/m8bs
As you can see it works in a P tag (just above the slug) but it doesn't work in my textarea. I think CKEditor encode my content but I don't know when and why... In my database everything is ok, I have the codes into the PRE tag.
Check these two plugins:
http://ckeditor.com/addon/insertpre
http://ckeditor.com/addon/syntaxhighlight
We use the first one on http://ckeditor.com/forum and it works very well.
Update: That's because you're not encoding HTML before you pass it to textarea. Use htmlspecialchars (or other similar function if you're not using PHP) to do that.
Update2: You are doing something wrong, but I don't know on what stage. The output data (editor.getData()) from the editor with one <pre> element is:
<pre class="prettyprint"><div></pre>
See that <pre> is not encoded, but <div> inside it is. Your examples show me that you "flattened" that structure - you have encoded both things equally when it should be:
<pre class="prettyprint"><div></pre>
Note: < is an encoded <.
You can use source menu in ck editor header to add your html
Use this tutorial
demo link
Okay Try This
for added Post
addslashes($_POST['post_from_textarea']);
to Edit
stripslashes($yourvairablegetRowsQuery)
I am writing a firebreath plugin that is supposed to display some object.
There are many cases of failure, since it is communicating with local software.
In case of a failure I want to close the plugin and to display a regular image instead. Or to get an image URL as a parameter, to parse the file and display it.
Both options are acceptable.
So-
What is the better option?
How do I totally close the plugin?
How do I parse parameters that are passed form the object tag?
I tried plugin->getParam("Name"), but didn't get the valueI passed.
How do I do it?
Assuming your HTML looks something like this:
<div id="plugincontainer">
<object id="myplugin" type="application/x-myplugin" width="100" height="100">
</object>
</div>
You should be able to remove the plugin like this:
document.GetElementById('plugincontainer').innerHTML = "";
Or if you're using jQuery:
$("#plugincontainer").empty();
This will result in a call to onWindowDetached inside of Firebreath where you can unload your code.
You're then able to add new HTML into the DOM:
$("#plugincontainer").append("<img src='images/my.jpg' />");
Dear friends,I want to extract text 平均3.6 星 from this code segment excerpted from amazon.cn.
<div class="content"><ul>
<li><b>用户评分:</b>
<span class="crAvgStars" style="white-space:no-wrap;">
<span class="asinReviewsSummary" ref="dp_db_cm_cr_acr_pop_" name="B004GUSIKO">
<a>
<span class="swSprite s_star_3_5 " title="平均3.6 星">
<span>平均3.6 星</span>
</span>
</a>
My question is span class tag value "s_star_3_5 " vary from different customer's rating level and appended dynamically. So I attempt to use doc.DocumentNode.SelectSingleNode(" //span[#class='swSprite']").InnerText or //span[#class='swSprite s_star_3_5 '], but the result is an error or not what my want !
Any suggestions?
First of all, I suggest you saving the value of doc.DocumentNode.OuterHtml to a local .html file and see if the code you're obtaining is that code. The thing is that sometimes you start parsing a website using HtmlAgilityPack, but the very first problem is that you're not getting the valid HTML correctly. Maybe you're getting a 404 error, or a redirection, etc.
I'm suggesting this because I tested //span[#class='swSprite s_star_3_5 '] and worked correctly.
That was the issue in the following questions:
Selecting nodes that have an attribute with spaces using HTMLAgilityPack
XPath Query Problem using HTML Agility Pack
If that doesn't help, post the HTML code and I'll help you ;)
This works for me:
HtmlDocument doc = new HtmlDocument();
doc.Load(myHtml);
HtmlNode node = doc.DocumentNode.SelectSingleNode("//span[starts-with(#class, 'swSprite')]");
Console.WriteLine("Text=" + node.InnerText.Trim());
and outputs
平均3.6 星
Note I use the XPATH starts-with function.