Results 1 to 2 of 2

Thread: XML>HTML output on several pages

  1. #1
    Join Date
    Sep 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy XML>HTML output on several pages

    Hi, i've managed to write a script that retrieves an xml file and outputs the contents to html, it works fine but the output is too long, this is my script so far:

    PHP Code:
    $bbc simplexml_load_file('xmlfile.xml');
        
    $bebese $bbc->xpath('//programme'); //search for all "programme" elements
        
    echo "\t<div id=\"listings\">\n";
        echo 
    "\t<p class=\"desc\"><b>$fulltime</b> and forward.\n</p><br />";
        
        foreach(
    $bebese as $result) { 
        if (
    $result->end $myTajm) {
            echo 
    $i;
            echo 
    "<div class=\"title\">{$result->title}<p class=\"time\">{$result->start} - {$result->end}</p></div>";
            echo 
    "<p class=\"desc\">{$result->desc}</p>";
            echo 
    "<p class=\"desc\">For more info: <a onclick=\"window.open(this.href,'newwin'); return false;\" href=\"{$result->infourl}\">{$result->title}</a></p>";
            echo 
    "<br />";

    }

    But like i said, the output is several pages long, i would like it to "end" after lets say 10 entries, then save the rest for a second and maybe a third page, like action?get=entry?page=2 ..
    I was thinking to add something like a $counter, increase it until it's 10, then put out a link to the second page.

    Can anyone point me in the right direction?

    cheers
    Last edited by tugg; 09-29-2007 at 03:11 AM. Reason: changed the title

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    PHP Code:
    $st = @$_GET['page'];
    $st $st*10;
    $en $st+10;
    $n=0;
    foreach (...) {
    $n++;
    if (
    $st<=$n&&$n<=$en) {
    ...
    }

    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •