[tw] Re: Receiving data from a php file
Thanks Eric...thats damm awesome.opens up a whole new ball´park for me. Skye Em quarta-feira, 13 de novembro de 2013 22h38min49s UTC-3, Eric Shulman escreveu: On Wednesday, November 13, 2013 4:38:21 PM UTC-8, skye riquelme wrote: Hi Ericthanks...I am sure we are really close...but I cant get it to work. seems the onclick is not firing the code I am testing is - htmliframe src=AAA/testMysql.php id=testMYSQL style=width:100%;height:200px;/iframe a href=javascript:void(0) onclick= var frame=this.previousSibling; var txt=frame.contentDocument.body.innerHTML; localStorage.mysql=txt; check this out!/a/html wikify {{localStorage.mysql}} ..for now I am just putting the txt into a localStorage so I can quickly see if it worked... the php code is returning the text...but clicking the link does do anything make sure that the a is *immediately* following the closing /iframe... with *no whitespace* and, if you are using HTMLFormattingPlugin, use nowiki in the html block so newlines in the onclick handler code will be ignored. -e -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: Receiving data from a php file
Em quinta-feira, 14 de novembro de 2013 20h15min09s UTC-3, Yakov escreveu: Hello everyone, I'm by no means an expert in serverside scripting or client-server interaction, but shouldn't TW (as client-side) interact with php-script (server-side) with some POST/GET requests? Best regards, Yakov. четверг, 14 ноября 2013 г., 5:38:49 UTC+4 пользователь Eric Shulman написал: On Wednesday, November 13, 2013 4:38:21 PM UTC-8, skye riquelme wrote: Hi Ericthanks...I am sure we are really close...but I cant get it to work. seems the onclick is not firing the code I am testing is - htmliframe src=AAA/testMysql.php id=testMYSQL style=width:100%;height:200px;/iframe a href=javascript:void(0) onclick= var frame=this.previousSibling; var txt=frame.contentDocument.body.innerHTML; localStorage.mysql=txt; check this out!/a/html wikify {{localStorage.mysql}} ..for now I am just putting the txt into a localStorage so I can quickly see if it worked... the php code is returning the text...but clicking the link does do anything make sure that the a is *immediately* following the closing /iframe... with *no whitespace* and, if you are using HTMLFormattingPlugin, use nowiki in the html block so newlines in the onclick handler code will be ignored. -e -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: Receiving data from a php file
Hello everyone, I'm by no means an expert in serverside scripting or client-server interaction, but shouldn't TW (as client-side) interact with php-script (server-side) with some POST/GET requests? Best regards, Yakov. четверг, 14 ноября 2013 г., 5:38:49 UTC+4 пользователь Eric Shulman написал: On Wednesday, November 13, 2013 4:38:21 PM UTC-8, skye riquelme wrote: Hi Ericthanks...I am sure we are really close...but I cant get it to work. seems the onclick is not firing the code I am testing is - htmliframe src=AAA/testMysql.php id=testMYSQL style=width:100%;height:200px;/iframe a href=javascript:void(0) onclick= var frame=this.previousSibling; var txt=frame.contentDocument.body.innerHTML; localStorage.mysql=txt; check this out!/a/html wikify {{localStorage.mysql}} ..for now I am just putting the txt into a localStorage so I can quickly see if it worked... the php code is returning the text...but clicking the link does do anything make sure that the a is *immediately* following the closing /iframe... with *no whitespace* and, if you are using HTMLFormattingPlugin, use nowiki in the html block so newlines in the onclick handler code will be ignored. -e -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: Receiving data from a php file
Hey! Whatever data (I presume they're URLs) you get from PHP, you need to parse it in TW with JS/jQuery. There, you can add HTML code (or TW markdown) and make the links clickable. Linking to PHP will open the PHP file. w On Wednesday, November 13, 2013 3:35:56 AM UTC+1, skye riquelme wrote: Hi All Playing again with databases and getting information in and out of TW. So far I have a simple php file that opens a mysql database and reads some data... I can see that output in a tiddler using a simple html form and have specifying a target that is an iframe.so I can SEE the data..(its simple text in the iframe) BUT I want to be able to interact with the data click on urls.or even have the php file output simple javascript text that the receiving tiddler can evaluate... I tried -htmla href=AAA/testMysql.php target=_self refs/a/html but this opens the data overriding the whole TW itself!.. how can I receive the dta into a tiddler? Thanks in advance Skye -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: Receiving data from a php file
Thanks..as I said, the link returns the dataand I can format the output into JS code or whatever..but the result of the link is that the data is returned to window/tab where the TW is open... losing the TW.my question is how receive the data from the php link...into a tiddler...and not into a new window? Tha ks Skye Em quarta-feira, 13 de novembro de 2013 08h45min12s UTC-2, whatever escreveu: Hey! Whatever data (I presume they're URLs) you get from PHP, you need to parse it in TW with JS/jQuery. There, you can add HTML code (or TW markdown) and make the links clickable. Linking to PHP will open the PHP file. w On Wednesday, November 13, 2013 3:35:56 AM UTC+1, skye riquelme wrote: Hi All Playing again with databases and getting information in and out of TW. So far I have a simple php file that opens a mysql database and reads some data... I can see that output in a tiddler using a simple html form and have specifying a target that is an iframe.so I can SEE the data..(its simple text in the iframe) BUT I want to be able to interact with the data click on urls.or even have the php file output simple javascript text that the receiving tiddler can evaluate... I tried -htmla href=AAA/testMysql.php target=_self refs/a/html but this opens the data overriding the whole TW itself!.. how can I receive the dta into a tiddler? Thanks in advance Skye -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: Receiving data from a php file
On Wednesday, November 13, 2013 10:09:11 AM UTC-8, skye riquelme wrote: Thanks..as I said, the link returns the dataand I can format the output into JS code or whatever..but the result of the link is that the data is returned to window/tab where the TW is open... losing the TW.my question is how receive the data from the php link...into a tiddler...and not into a new window? You were correct to direct the PHP output to a target IFRAME. The trick is to gain access to the contents of that IFRAME once it is loaded with results. One problem is that there's no *automatic* way to know when the results are ready. A work-around is to use a link, immediately following the IFRAME, that can be clicked once the user observes that results are visible in the IFRAME. The link then accesses its previous sibling (the IFRAME), and reaches into the contentDocument.body to fetch the innerHTML of the results (in your use-case, just plain text). One other problem: browser restrictions on same protocol and/or same domain access to IFRAMES. Depending upon your particular use case, you might be able to work around this by putting your TW and the PHP script on the same server. Here's some HTML that demonstrates the basic syntax for access the IFRAME's text content --- htmliframe src=... style=width:100%;height:200px;/iframea href=javascript:; onclick= var frame=this.previousSibling; var txt=frame.contentDocument.body.innerHTML; // now that you have the 'txt' in a variable, you can parse/modify that text // and then call on store.saveTiddler(...,txt,...) to copy the text to a tiddler save data to tiddler/a/html --- enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY TIP JAR... http://TiddlyTools.github.com/fundraising.html#MakeADonation Professional TiddlyWiki Consulting Services... Analysis, Design, and Custom Solutions: http://www.TiddlyTools.com/#Contact -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: Receiving data from a php file
Hi Ericthanks...I am sure we are really close...but I cant get it to work. seems the onclick is not firing the code I am testing is - htmliframe src=AAA/testMysql.php id=testMYSQL style=width:100%;height:200px;/iframe a href=javascript:void(0) onclick= var frame=this.previousSibling; var txt=frame.contentDocument.body.innerHTML; localStorage.mysql=txt; check this out!/a/html wikify {{localStorage.mysql}} ..for now I am just putting the txt into a localStorage so I can quickly see if it worked... the php code is returning the text...but clicking the link does do anything note that the TW where this code is embedded is on the same domain as the php scripthence the reletaive link! Why does this code work? Thanks Skye Em quarta-feira, 13 de novembro de 2013 15h47min55s UTC-3, Eric Shulman escreveu: On Wednesday, November 13, 2013 10:09:11 AM UTC-8, skye riquelme wrote: Thanks..as I said, the link returns the dataand I can format the output into JS code or whatever..but the result of the link is that the data is returned to window/tab where the TW is open... losing the TW.my question is how receive the data from the php link...into a tiddler...and not into a new window? You were correct to direct the PHP output to a target IFRAME. The trick is to gain access to the contents of that IFRAME once it is loaded with results. One problem is that there's no *automatic* way to know when the results are ready. A work-around is to use a link, immediately following the IFRAME, that can be clicked once the user observes that results are visible in the IFRAME. The link then accesses its previous sibling (the IFRAME), and reaches into the contentDocument.body to fetch the innerHTML of the results (in your use-case, just plain text). One other problem: browser restrictions on same protocol and/or same domain access to IFRAMES. Depending upon your particular use case, you might be able to work around this by putting your TW and the PHP script on the same server. Here's some HTML that demonstrates the basic syntax for access the IFRAME's text content --- htmliframe src=... style=width:100%;height:200px;/iframea href=javascript:; onclick= var frame=this.previousSibling; var txt=frame.contentDocument.body.innerHTML; // now that you have the 'txt' in a variable, you can parse/modify that text // and then call on store.saveTiddler(...,txt,...) to copy the text to a tiddler save data to tiddler/a/html --- enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY TIP JAR... http://TiddlyTools.github.com/fundraising.html#MakeADonation Professional TiddlyWiki Consulting Services... Analysis, Design, and Custom Solutions: http://www.TiddlyTools.com/#Contact -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.
[tw] Re: Receiving data from a php file
On Wednesday, November 13, 2013 4:38:21 PM UTC-8, skye riquelme wrote: Hi Ericthanks...I am sure we are really close...but I cant get it to work. seems the onclick is not firing the code I am testing is - htmliframe src=AAA/testMysql.php id=testMYSQL style=width:100%;height:200px;/iframe a href=javascript:void(0) onclick= var frame=this.previousSibling; var txt=frame.contentDocument.body.innerHTML; localStorage.mysql=txt; check this out!/a/html wikify {{localStorage.mysql}} ..for now I am just putting the txt into a localStorage so I can quickly see if it worked... the php code is returning the text...but clicking the link does do anything make sure that the a is *immediately* following the closing /iframe... with *no whitespace* and, if you are using HTMLFormattingPlugin, use nowiki in the html block so newlines in the onclick handler code will be ignored. -e -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/groups/opt_out.