Skip to content

Commit 47bf4cb

Browse files
committed
Merge pull request #66 from ARMmaster17/stable
Stable
2 parents 0e6d7da + 79283cd commit 47bf4cb

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

index.php

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,31 @@
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
1933
echo '<hr />';
2034
echo $cf_legal . '<br />';

posts/2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is the second post

posts/2.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MISSING DATA

posts/index.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
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>

0 commit comments

Comments
 (0)