HTML と CSS を編集できる Tumblr サイトがあります。現在の投稿のリンクを参照する {Permalink} という変数があります。
PHP は許可されていないため、スクリプトを外部でホストし、iframe を介してサイトに配置する必要がありました。問題は、スクリプトに次のものが含まれていることです。
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="YOUR URL" num_posts="1" width="460"></fb:comments>
「YOUR URL」を {Permalink} に置き換えたいと思います。PHP ファイルは外部でホストされているため、機能しません。だから私が探しているのは、未定義の変数をそこに置き、その変数を iframe で定義することです。
<iframe src="my.php" width: "460" data-urlvariable: "{Permalink}"></iframe>
そして私の.phpファイルで:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="$_data-urlvariable" num_posts="1" width="460"></fb:comments>
私はphp GETメソッドが仕事をするだろうと考えましたが、<div><script>
. 私のtumblrサイト内で変数を定義し、それを外部でホストされているphpファイルに入れる方法はありますか?
とにかく、これは .php ファイルの一部です。
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="YOUR URL" num_posts="1" width="460"></fb:comments>
<div style="visibility:hidden">
<?php
$STD_PATTERN = "<img src='@@userpicture@@'/><a href='@@userlink@@'>@@username@@</a> <BR> @@message@@ <BR> @@formatteddate@@<HR>";
/* PLEASE DON'T MODIFY THE CODE BELOW THIS COMMENT */
class SEO_FBComments {
const GRAPH_COMMENTS_URL = "https://graph.facebook.com/comments/?ids=";
private $pattern;
private $pageUrl;