Beginning Note: I am pretty sure this'll work, but I haven't tested it myself. Instead of doing this, I really suggest you change your $id to $page or something, if you can. This is a messy and most likely badly coded fix. Hell, it might not even work. :/ But if it does.................................
Title: Fix your CuteNews comments!
Author: JKaizer
Okay, you're the l33t webmaster. You're SO l33t that you use PHP! :O! And you even use CuteNews to make your life a billion times simpler! But... alas, there is a problem. You have this code:
and it doesnt't work with CuteNews. The comments give you a 404. ;
Here's the reason:
CuteNews uses $id and the code in there uses $id. The two $id's conflict, and give you a 404.
And Greg has found the answer! But it has an interesting little flaw, which has been put into account here.
okay, your website is l33t, and here is the code for it right now:
There are just a few changes that you're gonna have to make to get your news working again. First, rename news.txt to news.php. And then open up index.php. Take out this part:
And put it into a file named layout1.txt. Then go make layout2.txt with:
All that's left in index.php is now:
Make a few quick changes, by including the layout at the beginning and at the end.
Now we'll take a look at the flaw: there is no way to have index.php default to the news anymore! So we'll do this: create a file called news.txt:
And then create another new file called redirectcode.txt:
Simple enough, ne? Now just create a blank file called blank.txt. And now we're gonna open layout1.txt add this to the <head>:
Because our layout1.txt was simple and I wasn't thinking, we have to add the head code.
Still with me? Okay, we're almost done.
Now we open up news.php and include the layout:
And now we're done. ^_^ Open up layout1.txt and change your link from "?id=news" to "news.php" and it should work fine. ^_^;;
At the end, these are the files you should have:
layout2.txt
news.txt
blank.txt
redirectcode.txt
news.php
index.php
Hope you enjoy this messy fix. ^_^
Title: Fix your CuteNews comments!
Author: JKaizer
Okay, you're the l33t webmaster. You're SO l33t that you use PHP! :O! And you even use CuteNews to make your life a billion times simpler! But... alas, there is a problem. You have this code:
Code:
<?php
if (!$id) {
$id = "news";
$include = $id . ".txt";
}
else {
$include = $id . ".txt";
}
if (is_file($include) == "1") {
include $include;
}
else {
include "404.txt";
}
?>
Here's the reason:
CuteNews uses $id and the code in there uses $id. The two $id's conflict, and give you a 404.
And Greg has found the answer! But it has an interesting little flaw, which has been put into account here.
okay, your website is l33t, and here is the code for it right now:
Code:
[b]index.php[/b]
<html><title>My l33t non-XHTML comlpiant site</title><table><tr><td colspan="2"><img src="banner.gif"></td></tr><tr>
<td width="33%">
This is where hte navigation and affiliates hang out.
</td>
<td width="66%"><?php
if (!$id) {
$id = "news";
$include = $id . ".txt";
}
else {
$include = $id . ".txt";
}
if (is_file($include) == "1") {
include $include;
}
else {
include "404.txt";
}
?></td></tr>
<tr><td colspan="2">I own j00, but I don't own "l33t" Don't sue</td></tr></table></html>
Code:
[b]news.txt[/b]
<? $number = "20"; include("news/show_news.php"); ?>
There are just a few changes that you're gonna have to make to get your news working again. First, rename news.txt to news.php. And then open up index.php. Take out this part:
Code:
<html><title>My l33t non-XHTML comlpiant site</title><table><tr><td colspan="2"><img src="banner.gif"></td></tr><tr>
<td width="33%">
This is where hte navigation and affiliates hang out.
</td>
<td width="66%">
Code:
</td></tr>
<tr><td colspan="2">I own j00, but I don't own "l33t" Don't sue</td></tr></table></html>
Code:
<?php
if (!$id) {
$id = "news";
$include = $id . ".txt";
}
else {
$include = $id . ".txt";
}
if (is_file($include) == "1") {
include $include;
}
else {
include "404.txt";
}
?>
Code:
<? include("layout1.txt"); ?><?php
if (!$id) {
$id = "news";
$include = $id . ".txt";
}
else {
$include = $id . ".txt";
}
if (is_file($include) == "1") {
include $include;
}
else {
include "404.txt";
}
?><? include("layout2.txt"); ?>
Code:
Redirecting you to the news
Code:
<meta http-equiv="refresh" content="0; url=news.php">
Code:
<? if {
$id = "news";
include("redirectcode.txt");
}
else { include("blank.txt"); ?>
Because our layout1.txt was simple and I wasn't thinking, we have to add the head code.
Code:
<html><head><title>My l33t non-XHTML comlpiant site</title>
<? if {
$id = "news";
include("redirectcode.txt");
}
else { include("blank.txt"); ?>
</head><table><tr><td colspan="2"><img src="banner.gif"></td></tr><tr>
<td width="33%">
This is where hte navigation and affiliates hang out.
</td>
<td width="66%">
Now we open up news.php and include the layout:
Code:
<? include("layout1.txt"); $number = "20"; include("news/show_news.php"); include("layout2.txt"); ?>
And now we're done. ^_^ Open up layout1.txt and change your link from "?id=news" to "news.php" and it should work fine. ^_^;;
At the end, these are the files you should have:
Code:
[b]layout1.txt[/b]<html><head><title>My l33t non-XHTML comlpiant site</title>
<? if {
$id = "news";
include("redirectcode.txt");
}
else { include("blank.txt"); } ?>
</head><table><tr><td colspan="2"><img src="banner.gif"></td></tr><tr>
<td width="33%">
This is where hte navigation and affiliates hang out.
</td>
<td width="66%">
Code:
</td></tr>
<tr><td colspan="2">I own j00, but I don't own "l33t" Don't sue</td></tr></table></html>
Code:
Redirecting you to the news
Code:
{blank - nothing here}
Code:
<meta http-equiv="refresh" content="0; url=news.php">
Code:
<? include("layout1.txt"); $number = "20"; include("news/show_news.php"); include("layout2.txt"); ?>
Code:
<? include("layout1.txt"); ?><?php
if (!$id) {
$id = "news";
$include = $id . ".txt";
}
else {
$include = $id . ".txt";
}
if (is_file($include) == "1") {
include $include;
}
else {
include "404.txt";
}
?><? include("layout2.txt"); ?>
Hope you enjoy this messy fix. ^_^
Last edited: