小编Rod*_*the的帖子

如何使用PHP从XML"link"标记中提取"href"属性?

我很难过如何使用我的PHP解析脚本从这个XML位的"link"标签中提取"href"属性.如果它有帮助,我试图从GetSatisfaction API提要中提取特定帖子的URL.

以下是XML文件中的节点示例:

<entry>
  <link rel="something" href="http://...url_I_need" type="text/html"/>

  <title type="html">...title here...</title>
  <content type="html">
  ...content here...
  </content>
</entry>
Run Code Online (Sandbox Code Playgroud)

这是我的PHP XML解析脚本的数据收集部分:

$doc = new DOMDocument();
$doc->load('http://api.getsatisfaction.com/companies/issuetrak/topics?sort=recently_active&limit=7');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('entry') as $node) {
 $title = $node->getElementsByTagName('title')->item(0)->nodeValue;
 //I need to just store the link->href value to $link below
 //$link = ???;
}
Run Code Online (Sandbox Code Playgroud)

有关如何提取"href"属性的任何建议?

谢谢!

php xml xml-parsing

6
推荐指数
1
解决办法
4271
查看次数

如何在不完全停用Rich Text Editor的情况下隐藏TinyMCE工具栏onBlur?

当用户点击另一个页面元素并离开文本区域(基本上是onBlur)时,我试图隐藏TinyMCE工具栏.我找到了解决方案,它将停用Rich Text上的Rich Text Editor功能,但我只需要隐藏工具栏并保留Rich Text显示(而不是带有html标签的纯文本).

任何建议将不胜感激...谢谢!

这就是我现在拥有的:(它使用外部工具栏)

<html>
<head>
<!-- TinyMCE -->
<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
    theme_advanced_buttons1 : "fontselect,fontsizeselect,|,bullist,numlist,|,outdent,indent,|,blockquote,image,code,|,fullscreen",
    theme_advanced_buttons2 : "bold,italic,underline,strikethrough,sub,sup,hr,|,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink",
    theme_advanced_buttons3 : "tablecontrols,|,charmap",
    theme_advanced_toolbar_location : "external",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true
});
</script>

</head>
<body>

<form method="post" action="somepage">
    <br />
    <br />
    <br />
    <br />
    <br />
    <textarea name="content1" id="content1" style="width: 500px;">
        This is some sample <b><u>content</u></b>.
    </textarea>
    <br …
Run Code Online (Sandbox Code Playgroud)

javascript tinymce onblur

4
推荐指数
1
解决办法
9070
查看次数

标签 统计

javascript ×1

onblur ×1

php ×1

tinymce ×1

xml ×1

xml-parsing ×1