Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Meddysong Posted October 25, 2017 Posted October 25, 2017 I'd like to embed part of this page: https://lernu.net/en/vortaro/ The bit I'm interested in sits within a div with the id dictionary. I understand that the best approach is to use file_get_contents and then load the content that's contained within a div with the appropriate ID. That makes perfect sense to me. The problem is that my Googling produces something like this: $page = file_get_contents('http://touch.facebook.com'); $doc = new DOMDocument(); $doc->loadHTML($page); $divs = $doc->getElementsByTagName('div'); foreach($divs as $div) { // Loop through the DIVs looking for one withan id of "content" // Then echo out its contents (pardon the pun) if ($div->getAttribute('id') === 'content') { echo $div->nodeValue; } } I haven't got a clue how to rewrite that with template logic besides encasing the top lines between {{ and }} tags. Could anybody offer some pointers, please?
opentype Posted October 25, 2017 Posted October 25, 2017 I wouldn’t do that. It’s a very slow process, that needs to be repeated for every page load. If the form rarely changes, you can just copy the HTML to your page and then link the form to the external results page. (Granted you are allowed to do that.) The typical way to embed such forms is to have the owner of the site offer a raw version of the form to be placed in an iFrame or HTML widget.
Meddysong Posted October 25, 2017 Author Posted October 25, 2017 11 minutes ago, opentype said: I wouldn’t do that. It’s a very slow process, that needs to be repeated for every page load. If the form rarely changes, you can just copy the HTML to your page and then link the form to the external results page. (Granted you are allowed to do that.) The typical way to embed such forms is to have the owner of the site offer a raw version of the form to be placed in an iFrame or HTML widget. Hmm. I'm friends with the people running the site (we often cross-promote) so it might be worth asking whether they can do what you suggest. Not quite sure how to phrase that request in Esperanto though I'll speak to the woman who's in charge of the other site and see what they can do. Thanks!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.