CodeExample

4d3084f89e0ff: Difference between revisions

From Joomla! Documentation

Elkuku (talk | contribs)
CodeExample provided by Elkuku
 
Elkuku (talk | contribs)
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 17: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