• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

the index2.php?page=page

GoHaN172

New Member
for the:
index2.php?page=pageid i use the code

<?php
if (!$page || $page == "") {
include("pages/index.html");
} else {
include("pages/$page.html");
}
?>

is there a way u can modify that to use images? so it may be something like

<?php
if (!$page || $img == "") {
include("pages/index.html");
} else {
include("images/$img.jpg");
}
?>

but when i do that all it does is give me this error, i forget what it says because now all it does is show the index.html page
i also tried keeping it as "page" instead of "img" but it still doesnt work...
can anyone help me out?
 
Well, you can't include an image.

Instead of including, just:

PHP:
echo "<img src=\"$img.jpg\">";
 
Originally posted by Canuckkev
Well, you can't include an image.

Instead of including, just:

PHP:
echo "<img src=\"$img.jpg\">";

there's something wrong with the line... i keep getting parse errors
 
this is what i'm using now
PHP:
<?php
if (!$page || $img == "") {
include("screenshots.html");
} else {
echo '<img src=\"$img.jpg\">';
}
?>

i get a lil box with an X... where my pic is supossed to be
 
Last edited:
echo '<img src=\"$img.jpg\">';
You can't do that. You can either do what Canuckkev said:

echo "<img src=\"$img.jpg\">";

Or you can do what I'd of done:

echo '<img src="'.$img.'.jpg">';

Both do the same.

What're your parse errors?
 
to execute the variable i would use screenshot.php?img=imgname
right?

and what u gave me would be the whole script right?
 
When linking:

<a href="screenshot.php?img=image01">

Then, in screenshot.php:

PHP:
<HTML>
<BODY>


<?php
echo "<img src=\"$img.jpg\"><br>\n";
?>

<b>Now isn't that a purdy image?</b><br><br>
</BODY>
</HTML>

But, if you link to "screenshot.php?img=image02", and you don't have a "image02.jpg", you get a nice red X on your page (or equivalent).
 
Last edited:
with
<?php
if (!$page || $page == "") {
include("pages/index.html");
} else {
include("pages/$page.html");
}
?>

if i go to page.php?page=fred it load fred.html

how would i make it so if i go to
page.php?page=cheats&letter=k
it loads cheatsk.html

EDIT
Nevermind i figured it out all by myself :p
 
Last edited:
Originally posted by Moonman
with
<?php
if (!$page || $page == "") {
include("pages/index.html");
} else {
include("pages/$page.html");
}
?>

if i go to page.php?page=fred it load fred.html

how would i make it so if i go to
page.php?page=cheats&letter=k
it loads cheatsk.html

EDIT
Nevermind i figured it out all by myself :p

umm thats kind of interensting, what code did u use to do that man?

or how did u do it?
 
Last edited:
PHP:
$file == "$page$letter.html";
echo "<META HTTP-EQUIV="refresh" CONTENT="15;URL=/$file/">

should do the trick
 
Originally posted by dawizman
PHP:
$file == "$page$letter.html";
echo "<META HTTP-EQUIV="refresh" CONTENT="15;URL=/$file/">

should do the trick

i dont understand what u would have to do to execute it...

page.php?page=page&letter=letter ? but on the page... say on cheats.html (page=cheats)... how would u execute the &letter=letter part?
 
Last edited:
the code i use is
<?php
if($page == "" && $letter == "")
{
include("index.html");
}
else
{
include("$page$letter.html");
}
?>

so when i go to page.php?page=cheats&letter=b
it will load cheatsb.html, but if i just go to page.php it will load index.php, etc.
 
I would like to know if this would work...

<?php
if($cat == "" & $page == "")
{
include("index.html");
}
else
{
include("$cat/$page.html");
}
?>

[Edit]

It would look like page.php?cat=blah&page=blah right?

That would look for the folder blah and the page blah.html right?
 
Last edited:
Originally posted by GameSource
<?php
if($cat == "" & $page == "")
{
include("index.html");
}
else
{
include("$cat/$page.html");
}
?>
this wouldn't work.
it should be
if($cat=="" && $page=="")
{
include "index.php";
} else {
include("$cat/$page.html");
}

I myself would use
if(empty($cat) && empty($page))
{
include "index.php";
} else {
include($cat."/".$page.".html");
}

this should definitely work
 
Last edited:
Back
Top