php - How to pull data from xml and break it in pages (pagination) -
All of us, I am using simple XML to pull data from an external XML source. I have also found the prices to limit the number of results that I see. I thought I could paginate with some simple things like "end page = 2" with a simple query within the URL, but it is not possible to show this document.
I have downloaded a paging MYSQL query tried to use the VERS output from XM but the output is loading the entire result of XML and the URL is not specified within the Vars.
I think what I can do, count the results first and then confirm, which I am trying to do. Can you see anything in this code that can be improved? Sorry, if this is not clear, but maybe it's a discussion with some coders, I can see a little light at the end of the tunnel and make a little better.
So here's the code:
// See that I am already defining the maximum number of rows within the URL. Does it mean that the proper way to move it forward is to start moving forward?
$ all = New simple assemment ($ url, null, true); $ All- & gt; Item_tatal = $ hotel- & gt; Id;
//
require_once 'paginator.class.php'; // Call the pageinator class
foreach ($ $ $ as the hotel) // // loop through your phone {$ pages = new paginator;
// Creating a new pageinator $ pages-> mid_range = 7; $ Pages-> items_total = $ Hotel-> ID; // Remove Var from XML
$ rest = substr ($ Hotel-> Description, 0, -150); // Returns "ABCDE" / / echo & lt; & Lt; & Lt; EOF & lt; Table width = "100%" range = 0> & Lt; TR & gt; & Lt; Td colspan = "2" & gt; & Lt; A href = "{$ hotel- & gt; rooms- & gt; room- & gt; Book URL}" & gt; {$ Hotel- & gt; Name} & lt; Span class = "stars" Widht = "{$ hotel- & gt; ratings}" & gt; {$ Hotel- & gt; Rating} & lt; / Span & gt; & Lt; / H2 & gt; & Lt; / A & gt; & Lt; / A & gt; & Lt; P & gt; & Lt; B & gt; Direccion: & lt; / P & gt; & Lt; I & gt; {$ Hotel- & gt; Addresses} & lt; / I & gt; - {$ Hotel- & gt; Province} & lt; / P & gt; & Lt; Td colspan = "2" & gt; Div align = "center" & gt; PRECIO: {$ hotel- & gt; Currency code} {$ hotel- & gt; MinCostOfStay & lt; / A & gt; & Lt; / Div & gt; & Lt; / A & gt; & Lt; / A & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td colspan = "2" & gt; $ Remaining ... & lt; A href = "{$ hotel- & gt; rooms- & gt; rooms- & gt; Book URL}" & gt; & Lt; Strong & gt; Employee informational & lt; / Strong & gt; & Lt; / A & gt; & Lt; / Td> & Lt; Td valign = "middle" & gt; Div align = "center" & gt; & Lt; A href = "{$ hotel-> rooms- & gt; rooms- & gt; bookUrl}" & gt; & Lt; Img src = "{$ Hotel-> photoUrl}" & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td colspan = "2" & gt; Div align = "center" & gt; & Lt; A href = "{$ hotel-> rooms- & gt; rooms- & gt; bookUrl}" & gt; & Lt; Strong & gt; VER TODO SOBRE ESTE & lt; / Strong> & Lt; / A & gt; & Lt; / Div & gt; & Lt; / Td> & Lt; Td colspan = "2" & gt; & Lt; Div align = "center" & gt; $ Text & lt; / A & gt; & Lt; / Div & gt; & Lt; / Td> & Lt; / A & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt; / TR & gt; // EOF; Echo '& lt; / Table & gt; '; $ Pages & gt; Pagination (); } Echo $ pages-> Display_pages (); ? & Gt;
You can set your $ all
variable: / P>
$ all = new SimpleXMlelement ($ url, null, true); // All used by Loop $ = new pageinator; // reset within the loop
Comments
Post a Comment