CodeExample

Difference between revisions of "4d3084f89e0ff"

From Joomla! Documentation

(CodeExample provided by Elkuku)
 
(missing title)
 
Line 1: Line 1:
 
<div class='example'>
 
<div class='example'>
<div class='example-title'><h4>No Title</h4></div>  
+
<div class='example-title'><h4>Get the attribute of an element</h4></div>  
 
  <div class='commentBlock'>
 
  <div class='commentBlock'>
  

Latest revision as of 12:17, 14 January 2011

Get the attribute of an element

demo.xml

<jdoc>
	<doku kategory="Info">Wiki</doku>
</jdoc>
<?php

$xml = JFactory::getXML('demo.xml');

echo $xml->doku->getAttribute('kategory');

/* Better: */
echo $xml->doku->attributes()->kategory;

Output:

Info

Elkuku 11:16, 14 January 2011 (CST) Edit comment