php - How to display info if a tag value is X -


i know how can display na info xml if value of tag canfonti.

so, have na updated xml page: http://www.cidadehoje.pt/musics/musics/te.xml

snippet:

<onairplaylist radio="radio cidade hoje">     <element>         <author>doismileoito</author>         <title>sÓ faÇo bem (2011)</title>         <genre>pop</genre>         <table>canfonti</table>         <id>0019826001</id>     </element>     <element>         <author>anotherguy</author>         <title>let's play song</title>         <genre>foo</genre>         <table>bar</table>         <id>9999999991</id>     </element> </onairplaylist> 

and code:

<?php $x = simplexml_load_file('http://www.cidadehoje.pt/musics/musics/te.xml'); echo '<font color="#ffffff" face="raleway-light" size="+3" style="display:inline">'; echo $x->element[0]->author[0]; echo ' - '; echo $x->element[0]->title[0]; echo '</font>'; ?> 

i want show "author - title" if tag "table" have value "canfonti".

can me this?

thank in advance.

if mean this:

<?php $x = simplexml_load_file('http://www.cidadehoje.pt/musics/musics/te.xml'); if($x->element[0]->table[0] == "canfonti") {     echo '<font color="#ffffff" face="raleway-light" size="+3" style="display:inline">';     echo $x->element[0]->tag[0];     echo ' - ';     echo $x->element[0]->title[0];     echo '</font>'; } ?> 

you should read book php.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -