File tree Expand file tree Collapse file tree 4 files changed +29
-13
lines changed Expand file tree Collapse file tree 4 files changed +29
-13
lines changed Original file line number Diff line number Diff line change 44//start posts
55$ postdata = simplexml_load_file ('posts/index.xml ' );
66$ numposts = count ($ postdata ->post );
7- $ startindex = $ numposts - 1 ;
7+ $ maxindex = $ numposts - 1 ;
88$ rows = $ cf_hp_visposts ;
9- for ( $ i = $ startindex ; $ i >= 0 ; $ i -- )
9+ if ( $ numposts > $ rows )
1010{
11- echo '<h3> ' . $ postdata ->post [$ i ]->title . '</h3> ' ;
12- echo '<h5> ' . $ postdata ->post [$ i ]->data . '</h5> ' ;
13- $ fh = fopen ('posts/ ' . $ postdata ->post [$ i ]->content , 'r ' );
14- echo '<p> ' . fread ($ fh , filesize ('posts/ ' . $ postdata ->post [$ i ]->content )) . '</p><br /> ' ;
15- fclose ($ fh );
11+ for ($ i = 0 ; $ i <= $ rows ; $ i ++)
12+ {
13+ echo '<h3> ' . $ postdata ->post [$ i ]->title . '</h3> ' ;
14+ echo '<h5> ' . $ postdata ->post [$ i ]->data . '</h5> ' ;
15+ $ fh = fopen ('posts/ ' . $ postdata ->post [$ i ]->content , 'r ' );
16+ echo '<p> ' . fread ($ fh , filesize ('posts/ ' . $ postdata ->post [$ i ]->content )) . '</p><br /> ' ;
17+ fclose ($ fh );
18+ }
1619}
1720
21+ else
22+ {
23+ for ($ i = 0 ; $ i < $ numposts ; $ i ++)
24+ {
25+ echo '<h3> ' . $ postdata ->post [$ i ]->title . '</h3> ' ;
26+ echo '<h5> ' . $ postdata ->post [$ i ]->data . '</h5> ' ;
27+ $ fh = fopen ('posts/ ' . $ postdata ->post [$ i ]->content , 'r ' );
28+ echo '<p> ' . fread ($ fh , filesize ('posts/ ' . $ postdata ->post [$ i ]->content )) . '</p><br /> ' ;
29+ fclose ($ fh );
30+ }
31+ }
1832//begin footer of visible page
1933echo '<hr /> ' ;
2034echo $ cf_legal . '<br /> ' ;
Original file line number Diff line number Diff line change 1+ This is the second post
Original file line number Diff line number Diff line change 1+ MISSING DATA
Original file line number Diff line number Diff line change 11<posts >
2- <post >
3- <title >First Post</title >
4- <content >1.txt</content >
5- <data >1.xml</data >
6- <tag >1</tag >
7- </post >
82 <post >
93 <title >Second Post</title >
104 <content >2.txt</content >
115 <data >2.xml</data >
126 <tag >2</tag >
137 </post >
8+ <post >
9+ <title >First Post</title >
10+ <content >1.txt</content >
11+ <data >1.xml</data >
12+ <tag >1</tag >
13+ </post >
1414</posts >
You can’t perform that action at this time.
0 commit comments