javascript - PHP function to get current URL isn't dynamic on Twitter -
i'm trying utilize function every news article on site shows reactions on twitter link. i'm trying php function getting current url, returns 1 link, every other article on site shows same results.
this i'm trying:
<a class="twitter-timeline" href="https://twitter.com/search?q=<?php echo curpageurl();?>" data-widget-id="481435876400984065">tweets sobre "@vivamovilcl"</a><script>!function(d,s,id){var js,fjs=d.getelementsbytagname(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getelementbyid(id)){js=d.createelement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentnode.insertbefore(js,fjs);}}(document,"script","twitter-wjs");</script> so unusual thing is... works whichever first url try, , when open other url shows results first one. it's it's not refreshing on every article.
help anyone?
this curpageurl:
<?php function curpageurl() { $pageurl = 'http'; if ($_server["https"] == "on") $pageurl .= "s";} $pageurl .= "://"; if ($_server["server_port"] != "80") { $pageurl .= $_server["server_name"].":".$_server["server_port"].$_server["request_uri"]; } else { $pageurl .= $_server["server_name"].$_server["request_uri"]; } homecoming $pageurl; } ?> what happens gets tweets (curpageurl) links perfectly. it's if twitter widget locks it. life if limited query 1 variation instead of letting give me dynamic results each page
without knowing curpageurl() , site urls exactly, problem trying send real url query parameter.
you should encode url contains characters not valid query parameter value , / or might contain characters terminate current parameter value space or & character:
q=<?php echo urlencode(curpageurl()); ?> javascript php url dynamic twitter
No comments:
Post a Comment