• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
simpleXML pagination

I’m trying to get pagination to work with simpleXML but struggling to get anywhere.

my xml

<?xml version="1.0" ?>
       <name>Company Name</name>
       <description>company description</description>

model php

function list_companies($xml_file) {
        $xml = simplexml_load_file($xml_file);        
        $data = $xml->xpath('company');
        return $data;

controller php

public function index() {    
        $data['companies'] = $this->companies_model->list_companies($data['companies_xml']);

veiw php

&lt;?php foreach($companies as $row): ?&gt;
    <article class="company">
        <img >logo;?&gt;" alt="" class="left"/>
        <div class="details left">

    &lt;?php endforeach;?&gt;

You're likely retrieving the wrong part of your SimpleXML element. Play around with your list_companies() model function until it returns the data that you want (an array).

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.