Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
RevCMS News Help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Dan822" data-source="post: 368923" data-attributes="member: 37407"><p>Hi,</p><p></p><p>My news page is all functioning fine, however in the indexing it lists each article twice, as shown below</p><p><img src="https://i.gyazo.com/d90225f06b7d8dc0cb9d4f2b347e10af.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p>My news page archiving code:</p><p>[php]</p><p><?php</p><p> {</p><p> for ($i = 0; $i < 6; $i++)</p><p> {</p><p> $sectionName = "";</p><p> $sectionCutoffMax = 0;</p><p> $sectionCutoffMin = 0;</p><p> </p><p> switch ($i)</p><p> {</p><p> case 0:</p><p> </p><p> $sectionName = 'Today';</p><p> $sectionCutoffMax = time();</p><p> $sectionCutoffMin = time() - 86400;</p><p> break;</p><p> </p><p> case 1:</p><p> </p><p> $sectionName = 'Yesterday';</p><p> $sectionCutoffMax = time() - 86400;</p><p> $sectionCutoffMin = time() - 172800;</p><p> break;</p><p> </p><p> case 2:</p><p> </p><p> $sectionName = 'This week';</p><p> $sectionCutoffMax = time() - 172800;</p><p> $sectionCutoffMin = time() - 604800;</p><p> break;</p><p> </p><p> case 3:</p><p> </p><p> $sectionName = 'Last week';</p><p> $sectionCutoffMax = time() - 604800;</p><p> $sectionCutoffMin = time() - 1209600;</p><p> break;</p><p> </p><p> case 4:</p><p> </p><p> $sectionName = 'This month';</p><p> $sectionCutoffMax = time() - 1209600;</p><p> $sectionCutoffMin = time() - 2592000;</p><p> break;</p><p> </p><p> case 5:</p><p> </p><p> $sectionName = 'Last month';</p><p> $sectionCutoffMax = time() - 2592000;</p><p> $sectionCutoffMin = time() - 5184000;</p><p> break;</p><p> }</p><p> </p><p> $q = "SELECT * FROM cms_news WHERE published >= " . $sectionCutoffMin . " AND published <= " . $sectionCutoffMax . " ORDER BY published DESC";</p><p> $getArticles = mysql_query($q);</p><p> if (mysql_num_rows($getArticles) > 0)</p><p> {</p><p> echo '<h2>' . $sectionName . '</h2>';</p><p> </p><p> while ($a = mysql_fetch_assoc($getArticles))</p><p> {</p><p> if($a['id'] == $_GET['id'])</p><p> {</p><p> echo '' . $a['title'] . '&nbsp;&raquo;';</p><p> }</p><p> else</p><p> {</p><p> echo '<li><a href="/index.php?url=news&id=' . $a['id'] . '">' . $a['title'] . '&nbsp;&raquo;</a></li>';</p><p> }</p><p> }</p><p> }</p><p> }</p><p> }</p><p>?></p><p>[/php]</p></blockquote><p></p>
[QUOTE="Dan822, post: 368923, member: 37407"] Hi, My news page is all functioning fine, however in the indexing it lists each article twice, as shown below [img]https://i.gyazo.com/d90225f06b7d8dc0cb9d4f2b347e10af.png[/img] My news page archiving code: [php] <?php { for ($i = 0; $i < 6; $i++) { $sectionName = ""; $sectionCutoffMax = 0; $sectionCutoffMin = 0; switch ($i) { case 0: $sectionName = 'Today'; $sectionCutoffMax = time(); $sectionCutoffMin = time() - 86400; break; case 1: $sectionName = 'Yesterday'; $sectionCutoffMax = time() - 86400; $sectionCutoffMin = time() - 172800; break; case 2: $sectionName = 'This week'; $sectionCutoffMax = time() - 172800; $sectionCutoffMin = time() - 604800; break; case 3: $sectionName = 'Last week'; $sectionCutoffMax = time() - 604800; $sectionCutoffMin = time() - 1209600; break; case 4: $sectionName = 'This month'; $sectionCutoffMax = time() - 1209600; $sectionCutoffMin = time() - 2592000; break; case 5: $sectionName = 'Last month'; $sectionCutoffMax = time() - 2592000; $sectionCutoffMin = time() - 5184000; break; } $q = "SELECT * FROM cms_news WHERE published >= " . $sectionCutoffMin . " AND published <= " . $sectionCutoffMax . " ORDER BY published DESC"; $getArticles = mysql_query($q); if (mysql_num_rows($getArticles) > 0) { echo '<h2>' . $sectionName . '</h2>'; while ($a = mysql_fetch_assoc($getArticles)) { if($a['id'] == $_GET['id']) { echo '' . $a['title'] . ' »'; } else { echo '<li><a href="/index.php?url=news&id=' . $a['id'] . '">' . $a['title'] . ' »</a></li>'; } } } } } ?> [/php] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
RevCMS News Help
Top