Permalänk
Medlem

PHP kod funkar inte......

jag har ett problem.. med PHP..
mina koder funkar inte eller så e det jag som inte vet hur man publiserad det... och allt ligger i samma map.. och det e ett galleri

koder:
<?php include_once("CustomGallery.definition.php") ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo $gallery->getTitle() ?> / Thumbnails</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body class="thumbnails">

<div id="header">
<h1><?php echo $gallery->getTitle() ?></h1>
</div>
<div id="content">
<?php echo $gallery->getThumbnailsDisplay() ?>
<br style="clear:both" />
</div>

</body>
</html>

____________________________________________________________

<?php include_once("CustomGallery.definition.php") ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo $gallery->getTitle() ?> / Photo <?php echo $gallery->getActiveDisplay() ?></title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body class="photo">

<div id="header">
<h1><?php echo $gallery->getTitle() ?></h1>
</div>
<div id="navigation">
<p><?php echo $gallery->getCountDisplay() ?> | <?php echo $gallery->getPreviousDisplay() ?> | <?php echo $gallery->getNextDisplay() ?> | <a href="index.php" title="View Thumbnails">Back to Thumbnails</a></p>
</div>
<div id="content">
<p><?php echo $gallery->getActiveTextDisplay() ?></p>
<p><?php echo $gallery->getActiveImageDisplay() ?></p>
</div>

</body>
</html>

____________________________________________________________

<?php

Class Gallery {

var $photo_array;
var $image_directory;
var $active_index;

function Gallery(){
$this->photo_array = array();
$this->image_directory = "";
$this->active_index = null;
}

// set data
function addPhoto($image, $thumb, $text){
$photo = array("image" => $image, "thumb" => $thumb, "text" => $text);
array_push($this->photo_array, $photo);
}

// get data
function getActiveText(){
return $this->photo_array[$this->getActive()]["text"];
}
function getActiveImage(){
return $this->getDirectory() . $this->photo_array[$this->getActive()]["image"];
}
function getThumbnails(){
$result = array();
for($i = 0; $i < $this->getCount(); $i++){
array_push($result, $this->getDirectory() . $this->photo_array[$i]["thumb"]);
}
return $result;
}

// get/set directory
function setDirectory($directory){
$this->image_directory = $directory;
}
function getDirectory(){
return $this->image_directory;
}

// get/set index
function setActive($index){
$this->active_index = $index;
}
function getActive(){
return $this->active_index;
}
function getPrevious(){
$index = $this->getActive();
return ($index > 0) ? $index-1 : null;
}
function getNext(){
$index = $this->getActive();
return ($index < $this->getCount()-1) ? $index+1 : null;
}
function getCount(){
return count($this->photo_array);
}
}

?>

____________________________________________________________

<?php

include_once("CustomGallery.class.php");

$gallery = new CustomGallery();

$gallery->setTitle("My Gallery");
$gallery->setDirectory("photos/");
$gallery->addPhoto ( "photo_01.jpg", "tn_photo_01.jpg", "This is the caption for photo 1." );
$gallery->addPhoto ( "photo_02.jpg", "tn_photo_02.jpg", "This is the caption for photo 2." );
$gallery->addPhoto ( "photo_03.jpg", "tn_photo_03.jpg", "This is the caption for photo 3." );
$gallery->addPhoto ( "photo_04.jpg", "tn_photo_04.jpg", "This is the caption for photo 4." );
$gallery->addPhoto ( "photo_05.jpg", "tn_photo_05.jpg", "This is the caption for photo 5." );
$gallery->addPhoto ( "photo_06.jpg", "tn_photo_06.jpg", "This is the caption for photo 6." );
$gallery->addPhoto ( "photo_07.jpg", "tn_photo_07.jpg", "This is the caption for photo 7." );
$gallery->addPhoto ( "photo_08.jpg", "tn_photo_08.jpg", "This is the caption for photo 8." );

?>

____________________________________________________________

<?php

include_once("Gallery.class.php");

class CustomGallery extends Gallery {

var $title;

function CustomGallery(){
$this->Gallery();
$this->title = "";
$index = isset($_GET["id"]) ? $_GET["id"]-1 : 0;
Gallery::setActive($index);
}

// get/set title
function setTitle($title){
$this->title = $title;
}
function getTitle(){
return $this->title;
}

// get/set display index
function getActiveDisplay(){
return ($this->getActive()+1);
}
function getCountDisplay(){
return $this->getActiveDisplay() ." of ". $this->getCount();
}
function getPreviousDisplay(){
$index = $this->getPrevious();
if(is_int($index)) return "<a href=\"photo.php?id=".($index+1)."\" title=\"Previous Photo\">Previous</a>";
else return "<span>Previous</span>";
}
function getNextDisplay(){
$index = $this->getNext();
if(is_int($index)) return "<a href=\"photo.php?id=".($index+1)."\" title=\"Next Photo\">Next</a>";
else return "<span>Next</span>";
}

// get/set display data
function getActiveTextDisplay(){
return $this->getActiveText();
}
function getActiveImageDisplay(){
$image = $this->getActiveImage();
$index = $this->getActiveDisplay();
list($width, $height) = getimagesize($image);
return "<img src=\"$image\" width=\"$width\" height=\"$height\" alt=\"Photo $index\" />";
}
function getThumbnailsDisplay(){
$thumbnails = $this->getThumbnails();
$result = "";
for($i = 0; $i < count($thumbnails); $i++){
$index = $i+1;
$thumb = $thumbnails[$i];
list($width, $height) = getimagesize($thumb);
$result .= "<span><a href=\"photo.php?id=$index\" title=\"View Photo $index\"><img src=\"$thumb\" width=\"$width\" height=\"$height\" alt=\"Thumbnail $index\" /></a></span>";
}
return $result;
}
}

?>

ja det e mit problem..... Plz Hjälp mig...

Permalänk
Medlem

Har du lagt till PHP modulen i Apache?

Permalänk
Medlem

tror du seriöst någon ska svara på det där?

Permalänk
Medlem

använder inte Apache för jag har aldrig fåt det att funka :S ..... använder freewebs.com tills jag skafat mig någon server :S
och det e första gången jag håller på med PHP så... en liten fråga PHP modulen e vell kod filen?

Permalänk
Medlem

Vad är det som inte funkar? Felmeddelande?

Visa signatur

Swec @ 2001 / Chalmerist - Javisst!
'Den som har flest prylar när han dör vinner!'

Permalänk
Medlem

e ne vet inte hu jag ska "ladda up" det här på min sida så att det ska visas... som sagt det här e första gången jag håller på med PHP....

Permalänk
Medlem

Du har freewebs som webbhotell, de stödjer inte php..

Permalänk
Citat:

Ursprungligen inskrivet av dji
Du har freewebs som webbhotell, de stödjer inte php..

hahah satt och tänkte på det med

Permalänk
Medlem

ok.... någon som vet någon bra server eller ett gratis webbhotell som stöder PHP.....????

Permalänk
Permalänk
Medlem

ok.... det finns inga andra med lite mer utrymme???

Permalänk
Hedersmedlem

Inte gratis.

Visa signatur

Vim
Kinesis Classic Contoured (svart), Svorak (A5)
Medlem i signaturgruppen Vimzealoter.

Permalänk
Medlem

ok..... nu har jag nog lyckats med att fixa en Apache HTTP Server...
men jag fattar inte riktit hur man använder det.. vet ej hur man får sidan att visas... man kommer bara till en sida där alla filer e på och sen vet jag ej hur man får ut det på webben nu e det bara en localhost.....

Permalänk

http://dittip

Skapa en DNS, på tex no-ip.org eller dyn-dns.org

Skapa en index.html fil så kommer du inte bara till ett filindex.

Visa signatur

Asus Maximus II formula, E8400 @ 3.9GHz, 4GB Dominator DDR2, Radeon HD4850.

Permalänk
Medlem

Får jag fråga en liten offtopicfråga till jim003? Hur gammal är du?

Permalänk
Medlem
Citat:

Ursprungligen inskrivet av geeken
Får jag fråga en liten offtopicfråga till jim003? Hur gammal är du?

Men lägg ner.

Jim003: Det finns många billiga webhotel där ute... kolla in https://www.b-one.net/ och http://clichehosting.com/se/ t.ex.
Skulle väl kanske inte rekomendera cliche iofs, med tanke på att de kör med register_globals på on. :/

Visa signatur

All glory to the Hypno-toad.

Permalänk
Medlem
Citat:

Ursprungligen inskrivet av stafh
Men lägg ner.

Vadå lägg ner? Jag ställde bara en fråga...

Permalänk
Hedersmedlem

Tips, följ den här guiden: http://ematte.se/tut/wamp.php

Visa signatur

Vim
Kinesis Classic Contoured (svart), Svorak (A5)
Medlem i signaturgruppen Vimzealoter.

Permalänk
Medlem
Citat:

Ursprungligen inskrivet av geeken
Får jag fråga en liten offtopicfråga till jim003? Hur gammal är du?

jag e 16 år... men som sakt jag e inget profs som jag har sagt tidigare i den här tråden..
för det är första gången jag gör det här...

Permalänk
Medlem

Då vill jag tipsa om www.phpportalen.net. De har bra guider och forum.

Visa signatur

I distrust governments because I’ve studied history. Ask Joe this question: who does most of the killing? Who does most of the theft? Even the body-count of the worst criminals and terrorists pales in comparison to the death toll the average government inflicts on its own people. And it is not criminals who tax away 5/12ths of my income. - Eric S Raymond
http://www.css3.se

Permalänk
Medlem

okok tack!