- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试使用 Pin It 按钮,但它不会自动从页面获取 URL 和图像。如何使用 PHP 动态填充按钮?
有点像这样example ,但不使用 Genesis 框架。
最佳答案
我也想构建一个动态填充的 Pinterest 按钮,所以我把这个放在一起。它利用 simpleHTMLDom parser抓取页面上的第一张图片(用于图片)和页面上的第一段(用于描述)。可以修改这些选择器以获取正确的图像/文本。查看simpleHTMLDom documentation了解更多信息。
<?php
// Include our dom parser
include('simple_html_dom.php');
// Get the current page URL
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"];
}
return $pageURL;
}
$thispage = curPageURL();
// Grab our data
$html = file_get_html($thispage);
$imgtag = $html->find('img', 0)->src;
$desc = $html->find('p', 0)->plaintext;
// Build the URL
$pinURL = 'http://pinterest.com/pin/create/button/?url=' . $thispage . '&media=' . $imgtag . '&description=' . $desc . '';
$html->clear();
unset($html);
?>
现在我们只需在按钮链接中回显该新 URL。
<a href="<?php echo $pinURL ?>" class="pin-it-button" count-layout="horizontal">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
关于php - 使用 PHP 填充 Pinterest Pin It 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9509600/
我正在使用 - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id ) annotation{ 为自定义图钉
试图了解Box::pin()和Pin::new_unchecked()之间的区别。假设以下代码: use std::pin::Pin; use std::marker::PhantomPinned;
我有最新版本的 Intel Pin 3.0 版本 76887。 我有一个支持 MPX 的玩具示例: #include int g[10]; int main(int argc, char **arg
我正在寻找一种算法来创建类似于预付费电话卡的安全唯一随机数。我确实看过Generating a unique 15 digite Pin code from a 10digit number但它确实让
作为Hans Passant wishes这是我的场景。我有一个混合模式应用程序,其中 native 代码完成所有艰苦的工作,同时尊重性能,托管代码仅负责 GUI。用户也将通过编写他们专有的 C# 代
我正在尝试解决一个我不确定如何解决的问题。在我的应用程序中,本地图套件启动时,我会在用户的当前位置放置一个图钉。 Mapkit 委托(delegate)给 viewForAnnotation,它设置了
我在 android 应用程序中集成了 admob,我达到了阈值。它会显示一条消息,您的付款目前处于暂停状态,因为您尚未验证您的地址 有什么方法可以避免等待数周才能从 admob 收到用于地址验证的
我正在使用 get_user_pages在 Linux 内核驱动程序中,为了 [硬件] DMA 固定内存。一切似乎都很好 - 但我很难证明“固定”正在做正确的事情。 当我在做 get_user_pag
在使用 MKMapView 时,我确实注意到了 IOS 11 上的一个问题。 当我想从图钉对话框中点击按钮 Action 并且按钮 Action 后面有另一个图钉时,它没有得到手势。 应该是zPosi
我是 PIN 工具的新手。我只是尝试运行自述文件中给出的示例代码。 最初我使用以下方式构建: $ cd source/tools/ManualExamples $ make all 它正确编译并创建了
我遇到一个小问题...我有自己的网站,带有一个简单的 mysqli 登录脚本,每当我输入用户名、密码和 PIN 码时,它都会让我登录... 我现在的问题是,我可以仅使用用户名和密码登录我的网站(无需输
我有一个显示现金点位置的 map View 。注释被删除,可以单击标注以转到包含有关该位置的更多详细信息的页面。提款机分为免费和付费两种,免费的提款机别针是绿色的,另一个是红色的。当别针掉落时,它们就
我正在构建一个带有 GSM 调制解调器和 SIM 卡的设备。我想用别针保护 SIM 卡,以防止在现场安装设备时误用。 将关联 SIM 卡的 PIN 码存储到每个设备中会很麻烦。此外,如果更换 SIM
我正在编写一个需要共享流所有权的流适配器。 将流(私下)存储在 Pin>> 中是否正确? ? 如何调用poll_next(self: Pin在流? 最佳答案 Mutex没有所谓的结构钉扎,这在 std
我对 Pin 的要求感到困惑那个 a value, once pinned, must remain pinned forever. 我看到了the discussion thread on redd
我目前正在实现 TrustKit framework在我的 iOS 应用程序中为 SSL 连接启用 SPKI 固定。我偶然发现了正确配置 TrustKit 所必需的“备用密码”。不幸的是,API 文档
在 rust 中学习 Pin 的实现时我很困惑。 我知道当一个类型不能安全移动时,它可以实现 !Unpin。 Pin 是为了防止别人从这些类型中获取到&mut T,使他们不能是std::mem::sw
我用的是 SIM868 模块,我用的是我常用的 SIM 卡,没有问题,但现在我买了一张新的 SIM 卡,没有 pin。我需要添加 PIN 码以提高安全性。 我使用以下命令检查了它是否没有启用 PIN:
我想知道是否可以在自定义 MKMapView 中创建 MKPinAnnotation,它可以像 map 应用程序中的“Drop Pin”注释一样响应触摸和拖动。 我想要一种在 GPS 给出的位置放置图
我正在开发一个应用程序,我需要通过为用户设置密码/密码/密码来设置安全功能,以便每当他们从后台打开应用程序时,应用程序都会要求输入密码/密码/密码。我阅读了一些文章/解决方案,例如 this但他们没有
我是一名优秀的程序员,十分优秀!