Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1320816
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionImagine that I have an HTML file as one of my WordPress blog pages (let's call it page B). I want to write an if condition inside a tag on page B to check if a specific element exists on another web page (page A).
My question is what function should I choose to check this condition? Should I also import the HTML file of page A inside page B? And what should I do on the server-side, if I have to?
Thanks
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 4 years ago.
Improve this questionImagine that I have an HTML file as one of my WordPress blog pages (let's call it page B). I want to write an if condition inside a tag on page B to check if a specific element exists on another web page (page A).
My question is what function should I choose to check this condition? Should I also import the HTML file of page A inside page B? And what should I do on the server-side, if I have to?
Thanks
Share Improve this question edited Oct 1, 2020 at 12:46 Shima Masaeli asked Oct 1, 2020 at 12:41 Shima MasaeliShima Masaeli 32 bronze badges 1 |1 Answer
Reset to default 0If I understand you correctly, and you want to find an HTML element inside another page, you need to use some HTML parser.
Take a look at https://www.php/manual/en/domdocument.loadhtmlfile.php or https://github/paquettg/php-html-parser. I believe there are more tools that can help you with this.
On page B you load page A as a remote document by URL, then parse it and look for the desired HTML element.
本文标签: functionshow to check if an element in an html file exists in another html file
版权声明:本文标题:functions - how to check if an element in an html file exists in another html file? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742089667a2420187.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
.html
files in your site? What problem does this solve? It's a little too abstract/generic at the moment so context will help – Tom J Nowell ♦ Commented Oct 1, 2020 at 13:10