Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 3rd, 2009, 11:52 AM
margy80 margy80 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 9 margy80 User rank is Sergeant Major (2000 - 5000 Reputation Level)margy80 User rank is Sergeant Major (2000 - 5000 Reputation Level)margy80 User rank is Sergeant Major (2000 - 5000 Reputation Level)margy80 User rank is Sergeant Major (2000 - 5000 Reputation Level)margy80 User rank is Sergeant Major (2000 - 5000 Reputation Level)margy80 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 h 40 m 18 sec
Reputation Power: 0
Question Function to create a gallery

Hallo to everybody,
I’ve create this code… but it gave me a problem… I’m new in php so I don’t see the error… when I’m wrong? This a part of a gallery that I described here http://forums.devshed.com/beginner-programming-16/it-s-possible-618899.html.
Thank you to all and a good week!
PHP Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<
title>Documento senza titolo</title>
<?
php
function dir_reader($dir, &$images, &$subdirs
{
//Creo la funzione per la lettura nelle cartelle e nelle sottocartelle
    
global $defdir;
    
$dirdir(My_Gallery);
    if(
$dir != $defdir)
        {
        
$dir $defdir."/".$dir;
    }
header('Content-type:text/xml'); //Dichiarazione dell'xml
        
$xml="<galleria>"//nome dell'xml
    //apro la directory madre
    
if ($handle opendir($dir))
    {        
        while (
false !== ($file readdir($handle))) 
        {
            if (
$file != "." && $file != ".."
                {
                
//Assegno le variabili e Divido le stringhe                
                
list($file$ext) = explode("."$file);
                if(!
is_dir($dir.'/'.$file)) 
                {
                
//Specifico le estensioni dei file
                    
if($ext == "jpg" || $ext == "jpeg")
                    {
                        
$images[] = $file;
                    }
                    {
                    
$xml.= "pic image= \"../My_Gallery/$images\"/>\n";
                    }
                }
                else
                {
                
//Creo i link di collegamento
                    
$subdirs[] = "<a href='?My_Gallery=".$file."'>".$file."</a>";
                }
            }
        }
        
//Chiudo la cartella madre
        
closedir($handle);
    }

echo 
$xml;
//Nome della cartella madre
$defdir './My_Gallery';
if(!isset(
$_GET['My_Gallery']))
{
    
$dir $defdir;
}
else
{
    
$dir $_GET['My_Gallery'];
}
$images = array();
$subdirs = array();
dir_reader($dir$images$subdirs);
?>
<table border="2">
<tr>
<td>
<?php
// Includo la funzione random per le immagini
include "immagini_random.php"
//Includo la funzione per creazione di link
?>
</td>   
<td>
<?php
header 
(Content_type
// Inserisco il codice per la creazione della gallery e prelevamento dati per flash
while (list($chiave,$valore)= each($images))
{
    echo
"$valore </br>";
    echo 
"<img src=$images>";
    
$numero_elementi=count($images);
    echo 
"&numero_elementi=".$numero_elementi;
    for (
$i=0;$i<$numero_elementi;$i++)
    echo 
'&images_" .$i ."=" .$images[$i]';
}
}
$xml.="</galleria>";
?>
</td>
</tr>
</table>
</head>
</html> 


Bye

Last edited by aitken325i : July 4th, 2009 at 09:37 AM. Reason: Fixed PHP Tags

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > Function to create a gallery


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek