Click to See Complete Forum and Search --> : PHP Links
Wasiu0607
07-25-2003, 04:50 PM
I have problems with my links. For my website, I put <a href=main.php?id=akira.html> and uploaded my akira.html, but when I click on the link, nothing happened!
http://www.animeng.vzz.net/main.php is the URL. Thanks
We're going to need to see some code, and a description of what is supposed to happen...
Wasiu0607
07-26-2003, 12:55 AM
Um.. Like I don't want to have to copy my navigation code and stuff just to make a page, so I use the PHP code, like mentioned above, but its not working.
It's suppose to redirect to my other contents page (The page without the navigation and stuff) without losing my navigation.
Da Warriah
07-26-2003, 07:58 AM
it would still be a lot easier to help you if you posted your code...however, if youre using something like this:
if($id){
include $id;
}
you might find it easier to do something like this instead:
if($id){
include "$id.html";
}
then use your link as main.php?id=akira instead...
however if thats not what you're looking for, we're going to need to see some of your code...
Wasiu0607
07-26-2003, 01:12 PM
Where do I put that code?
What I mean is that I want my links to be like the website here: http://www.anime-star.com/news.php where the links say something like main.php?id=whatever
But when I put that on my navigation, <a href=main.php?id=akira.txt>Akira</a> and uploaded my Akira page, it doesn't even redirect to that page.. http://www.animeng.vzz.net/main.php is my website . The navigation are on the left. THanks
You place the PHP-code where you want the content from the file to appear on your page.
<?php
if($id){
include "$id.html";
}
?>
Then a link like index.php?id=test would make the contents of test.html appear there
Wasiu0607
07-26-2003, 08:30 PM
Okay, but I downloaded Fusion News program so that I can update news easier. (www.fusionphp.net) and I have to use <?php include "news/news.php";?> in order for my news to appear. But since I'm using that, how can I use the code you gave me above at the same time? Thanks
Da Warriah
07-26-2003, 08:48 PM
well ive used fusion news as well, and both will work just fine...just insert the code where you want the included page to display like Kr|Z said...
*reads post again* or are you wanting to switch pages from the news page, and include another file? try this if thats what you're wanting:
<?php
if($id == "news"){
include "news/news.php";
} else {
include "$id.html";
}
?>
Wasiu0607
07-27-2003, 12:34 AM
When I enter that code, it gave me the PHP error
Warning: main(.html): failed to open stream: No such file or directory in /data/hosted/animeng/main.php on line 120
Warning: main(.html): failed to open stream: No such file or directory in /data/hosted/animeng/main.php on line 120
Warning: main(): Failed opening '.html' for inclusion (include_path='./') in /data/hosted/animeng/main.php on line 120
<?php
if($id == "news"){
include "news/news.php";
} elseif($id) {
include "$id.html";
}
?>
Wasiu0607
07-27-2003, 11:13 AM
Ugh the codes still dont work.. Now my news dont even show up :/ ..
These are my codes for my content and navigation page:
<!-- start of content-->
<?php
if($id == "news"){
include "news/news.php";
} elseif($id) {
include "$id.html";
}
?>
<!--end of content-->
<!--start of main menu-->
<DIV style="LEFT: 20px; WIDTH: 145px; POSITION: absolute; TOP: 232px; HEIGHT: 400px">
<h1>Anime >>></h1>
<a href=main.php?page=anime/akira.html>Akira</a><br>
<a href=main.php?page=anime/cardc.html>Cardcaptors</a><br>
<a href=main.php?page=anime/evangelion.html>Evangelion</a><br>
<a href=main.php?page=anime/oh!mygoddess.html>Oh! My Goddess</a><br>
<a href=main.php?page=anime/technimuyo.html>Techni Muyo!</a><br>
<a href=main.php?page=anime/trigun.html>Trigun</a><br>
<a href=main.php?page=anime/yugioh.html>Yu-Gi-Oh!</a><br>
</p>
</div>
<!--end of main menu-->
Da Warriah
07-27-2003, 01:21 PM
well ok, lets see if we cant change this a bit...if you want the news to appear automatically, by default, change it to this:
<?php
if(!$id || $id == ""){
include "news/news.php";
}
elseif($id){
include "anime/$id.html";
}
?>
and then, change your links to this::
<a href=main.php?id=akira>Akira</a><br>
<a href=main.php?id=cardc>Cardcaptors</a><br>
<a href=main.php?id=evangelion>Evangelion</a><br>
<a href=main.php?id=oh!mygoddess>Oh! My Goddess</a><br>
<a href=main.php?id=technimuyo>Techni Muyo!</a><br>
<a href=main.php?id=trigun>Trigun</a><br>
<a href=main.php?id=yugioh>Yu-Gi-Oh!</a><br>
that should work a bit better for you...tho im not sure about the exclamation mark in the oh!mygoddess link...
Wasiu0607
07-27-2003, 06:45 PM
Ugh.. Yeah it worked a little. Now my news showed up, but its out of my DIV area. And when I goto Akira, it said the same error, the not found thing..:mad:
http://animeng.vzz.net/main.php
My whole codes:
<body topmargin=0 leftmargin=0 background=images/bg2.jpg text=black link=black>
<img src=images/header.jpg>
<!--Start of advertisement-->
<DIV style="LEFT: 26px; WIDTH: 295px; POSITION: absolute; TOP: 150px; HEIGHT: 70px">
<img src=images/adbanner.jpg style="filter:alpha(opacity=35)" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,35,50,5)">
</div>
<!--End of advertisement-->
<!--start of news ticker-->
<DIV style="LEFT: 343px; WIDTH: 119px; POSITION: absolute; TOP: 150px; HEIGHT: 60px">
<MARQUEE scrollAmount=2 direction=up width=119 height=60 onmouseover=this.stop() onmouseout=this.start()>
News
</marquee>
</div>
<!--end of news ticker-->
<!--start of features-->
<DIV style="LEFT: 500px; WIDTH: 237px; POSITION: absolute; TOP: 150px; HEIGHT: 59px">
<img src=feature.jpg style="filter:alpha(opacity=35)" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,35,50,5)">
</div>
<!--end of feature-->
<!--start of main menu-->
<DIV style="LEFT: 20px; WIDTH: 145px; POSITION: absolute; TOP: 232px; HEIGHT: 400px">
<h1>Anime >>></h1>
<a href=main.php?id=akira>Akira</a><br>
<a href=main.php?id=cardc>Cardcaptors</a><br>
<a href=main.php?id=evangelion>Evangelion</a><br>
<a href=main.php?id=oh!mygoddess>Oh! My Goddess</a><br>
<a href=main.php?id=technimuyo>Techni Muyo!</a><br>
<a href=main.php?id=trigun>Trigun</a><br>
<a href=main.php?id=yugioh>Yu-Gi-Oh!</a><br>
</p>
</div>
<!--end of main menu-->
<!--start of sub menu-->
<DIV style="LEFT: 184px; WIDTH: 100px; POSITION: absolute; TOP: 249px; HEIGHT: 400px">
<P style="MARGIN-TOP: 1px; MARGIN-BOTTOM: 1px">
<iframe src="http://animeng.vzz.net/shoutbox/shoutbox.php" name="shoutbox" width="139" height="440" frameborder="0"></iframe>
</div>
<!-- end of sub menu-->
<!-- start of content-->
<?php
if(!$id || $id == ""){
include "news/news.php";
}
elseif($id){
include "$id.html";
}
?>
<!--end of content-->
</body>
</html>
Nevermore
07-28-2003, 09:13 AM
Is it looking for akira.html in the right place?
Da Warriah
07-28-2003, 12:48 PM
no its not, you didnt change the PHP part of the code:
<?php
if(!$id || $id == ""){
include "news/news.php";
}
elseif($id){
include "anime/$id.html";
}
?>
that should find akira.html now...however as for being outside the div, you should put that code EXACTLY where you want the news to appear...something like this:
<div>
<?php
if(!$id || $id == ""){
include "news/news.php";
}
elseif($id){
include "anime/$id.html";
}
?>
</div>
I'd also have to recommend not using global variables. Add this to the top of the script:
$id = $_GET["id"];
Wasiu0607
07-28-2003, 05:49 PM
I copied the second one, with the DIV, but yet my news is still out of my DIV box..
The links seem to work fine now thanks ^_^
My codes:
<html>
<head>
<title>Anime nG V4.0 - The [Un]forgotten Layout 2</title>
<STYLE type=text/css>
h1 { color: #000000; font-size: 9pt; font-family: Arial; font-weight: normal; margin: 0pt; padding: 0pt; }
A:link {COLOR: #000000; TEXT-DECORATION: none}
A:visited {COLOR: #B4B4B4; TEXT-DECORATION: none}
A:active {COLOR: #4e4e4e}
A:hover {COLOR: #ffffff; text-decoration: none}
BODY {FONT-SIZE: 8pt; FONT-FAMILY:Arial; font-color: #33a9ff}
TR {FONT-SIZE: 8pt; FONT-FAMILY: Arial; font-color: #000000}
TABLE {FONT-SIZE: 8pt; FONT-FAMILY: Arial; font-color: #000000}
TD {FONT-SIZE: 8pt; FONT-FAMILY: Arial; font-color: #000000}
UL {FONT-SIZE: 8pt; FONT-FAMILY: Arial; font-color: #000000}
TEXTAREA {FONT-SIZE: 8pt; COLOR: #ffffff; FONT-FAMILY: Arial; BACKGROUND-COLOR: #6aa14d}
INPUT {FONT-SIZE: 8pt; COLOR: #ffffff; FONT-FAMILY: Arial; BACKGROUND-COLOR: #6aa14d}
BODY {SCROLLBAR-FACE-COLOR: #F3F7FF;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;
SCROLLBAR-SHADOW-COLOR: #000000;
SCROLLBAR-3DLIGHT-COLOR: #000000;
SCROLLBAR-ARROW-COLOR: #ffffff;
SCROLLBAR-TRACK-COLOR: #F7F6F7;
SCROLLBAR-DARKSHADOW-COLOR: #000000}
</STYLE>
<script>
// fade script
nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
/* object - image to be faded (actual object, not name);
* destop - destination transparency level (ie 80, for mostly solid)
* rate - time in milliseconds between trasparency changes (best under 100)
* delta - amount of change each time (ie 5, for 5% change in transparency)
*/
function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
if (object != "[object]"){ //do this so I can take a string too
setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
return;
}
clearTimeout(nereidFadeTimers[object.sourceIndex]);
diff = destOp-object.filters.alpha.opacity;
direction = 1;
if (object.filters.alpha.opacity > destOp){
direction = -1;
}
delta=Math.min(direction*diff,delta);
object.filters.alpha.opacity+=direction*delta;
if (object.filters.alpha.opacity != destOp){
nereidFadeObjects[object.sourceIndex]=object;
nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
}
}
</script>
</head>
<body topmargin=0 leftmargin=0 background=images/bg2.jpg text=black link=black>
<img src=images/header.jpg>
<!--Start of advertisement-->
<DIV style="LEFT: 26px; WIDTH: 295px; POSITION: absolute; TOP: 150px; HEIGHT: 70px">
<img src=images/adbanner.jpg style="filter:alpha(opacity=35)" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,35,50,5)">
</div>
<!--End of advertisement-->
<!--start of news ticker-->
<DIV style="LEFT: 343px; WIDTH: 119px; POSITION: absolute; TOP: 150px; HEIGHT: 60px">
<MARQUEE scrollAmount=2 direction=up width=119 height=60 onmouseover=this.stop() onmouseout=this.start()>
News
</marquee>
</div>
<!--end of news ticker-->
<!--start of features-->
<DIV style="LEFT: 500px; WIDTH: 237px; POSITION: absolute; TOP: 150px; HEIGHT: 59px">
<img src=feature.jpg style="filter:alpha(opacity=35)" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,35,50,5)">
</div>
<!--end of feature-->
<!--start of main menu-->
<DIV style="LEFT: 20px; WIDTH: 145px; POSITION: absolute; TOP: 232px; HEIGHT: 400px">
<h1>Anime >>></h1>
<a href=main.php?id=akira>Akira</a><br>
<a href=main.php?id=cardc>Cardcaptors</a><br>
<a href=main.php?id=evangelion>Evangelion</a><br>
<a href=main.php?id=oh!mygoddess>Oh! My Goddess</a><br>
<a href=main.php?id=technimuyo>Techni Muyo!</a><br>
<a href=main.php?id=trigun>Trigun</a><br>
<a href=main.php?id=yugioh>Yu-Gi-Oh!</a><br>
</p>
</div>
<!--end of main menu-->
<!--start of sub menu-->
<DIV style="LEFT: 184px; WIDTH: 100px; POSITION: absolute; TOP: 249px; HEIGHT: 400px">
<P style="MARGIN-TOP: 1px; MARGIN-BOTTOM: 1px">
<!-- end of sub menu-->
<!-- start of content-->
<div>
<?php
if(!$id || $id == ""){
include "news/news.php";
}
elseif($id){
include "$id.html";
}
?>
</div>
<!--end of content-->
</body>
</html>