Thread: xml..
View Single Post
Old 10-12-2007, 03:25 PM   #1 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default xml..

view.php
PHP Code:
<?php

/**
||||||||||||||||||||||||||||||||||||||||||
|||| @author Tanax
|||| @copyright 2007
||||||||||||||||||||||||||||||||||||||||||
**/

    
include('config.php');
    
$id $_GET['pic'];
    
$img $path $id $format;
    
    if(!
file_exists($img)) {
        
        echo 
'This picture does not exist!';
        
    }
    
    else {
        
        echo 
'<center>';
        echo 
'<table border="1" cellpadding="10">';
        echo 
'<tr><td><img src="'.$img.'" border="0" /><br />';
        
$file simplexml_load_string(file_get_contents($xml)); 

        foreach(
$file->desc as $desc) {
            
            if(
$desc['pic'] == $id) {
                
                echo 
$desc['info'];
                
            }
            
        }
        
        
        echo 
'</td></tr>';
        echo 
'</table>';
        echo 
'<a href="testing.php">Tillbaka</a>';
        echo 
'</center>';
        
    }



?>
config.php
PHP Code:
$xml 'desc.xml'
desc.xml
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<desc pic="1" info="Testing" />

It doesn't give me any error msgs, but it doesn't print the "testing" below the image :S

What's wrong? :(
Tanax is offline  
Reply With Quote