|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 2 Oct 2005 03:09:02 -0000 Issue 3714
php-general-digest-help
lists.php.net
Date: Sat Oct 01 2005 - 22:09:02 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 2 Oct 2005 03:09:02 -0000 Issue 3714
Topics (messages 223486 through 223505):
Re: Testing for an empty array (with null values)
223486 by: Jochem Maas
Re: Array: If i'm in the child array then how I tell the parent's key name..
223487 by: Ing. Josué Aranda
Re: creating a shopping cart.
223488 by: adriano ghezzi
223491 by: Robert Cummings
223492 by: Robert Cummings
223501 by: adriano ghezzi
Re: File Upload Max Size
223489 by: Anas Mughal
Re: PHP5, $_SESSION, DOM XML objects not returning value
223490 by: Jochem Maas
would this be a buffer problem or something else
223493 by: matt VanDeWalle
RecursiveIteratorIterator för PHP 5.0.5 Win32
223494 by: Erik Franzén
223495 by: Oliver Grätz
PHP & SOAP for production
223496 by: Reuben D. Budiardja
223498 by: jonathan
223500 by: Reuben D. Budiardja
Re: array_shift not working?
223497 by: Oliver Grätz
Yaz and PHP 5.0.3 (x-posted to php-install)
223499 by: Mark A. O'Neil
"Sanitize" paths
223502 by: Niels Ganser
223503 by: Philip Hallstrom
223504 by: Niels Ganser
function not returning anything via return$
223505 by: nalopaleaahu.aol.com
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
zzapper wrote:
> Hi,
> I can use
>
> if (count($somearray) > 0) to test for an empty array.
>
why don't you test it.
$a = array();
$b = array(null, null, null);
$c = array(false, false);
$d = array(1, 1, 1);
echo "array \$a: \n---------------------------\n";
var_dump(empty($a), count($a), array_filter($a), array_values($a));
echo "array \$b: \n---------------------------\n";
var_dump(empty($b), count($b), array_filter($b), array_values($b));
echo "array \$c: \n---------------------------\n";
var_dump(empty($c), count($c), array_filter($c), array_values($c));
echo "array \$d: \n---------------------------\n";
var_dump(empty($d), count($d), array_filter($d), array_values($d));
> It is possible to have an array with null values which is effectively empty but fails the above as
> it's count (I belive is greater than 0).
look above.
>
> Any ideas
plenty. hopefully the code above give you a few too :-)
>
attached mail follows:
Scott, I hope this code help you:
[PHP CODE]
/*
* Author:
* Josue Aranda <josue
ingeniodigital.com.mx>
*/
// This set an $arr
$arr = array(
'ABC' => array(
'DEF' => 'Data'
)
);
print_r($arr);
/*
* Will OutPut:
*
* Array
* (
* [ABC] => Array
* (
* [DEF] => Data
* )
*
* )
*/
echo $arr['ABC']['DEF']; // Will Output "Data"
$level = 0;
foreach ($arr as $key => $value){
$level++;
echo " Level: ".$level." Key: ".$key; // Will output "Level: 1 Key: ABC"
foreach ($value as $subKey => $subValue){
$level++;
echo " Level: ".$level." Key: ".$subKey; // Will OutPut "Level: 2 Key: DEF"
$level--;
}
$level--;
}
[/PHP CODE]
are you trying to make some kind of tree?
On 9/30/05, Scott Fletcher <scott
abcoa.com> wrote:
> Suppose that I'm in a child array and I wanna know how do I tell what key is
> the parent's level, one level up...
>
> For example,
>
> --snip--
> $arr['ABC']['DEF'];
> --snip--
>
> Let's say the child is "DEF" then the key name one level up would be "ABC".
> How do I determine the one level up?
>
> Thanks...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
________________________
JOSUE ARANDA>>>
http://josuearanda.com
attached mail follows:
you need a db based approach, just setup a couple of tables in mysql
items table
one record per item
current cart table
one record per each item added to cart with unique session id
order table
one record per each item ordered with unique order id
you'll transfer records here from current cart when user checkout
hope help
adriano
2005/10/1, Emil Novak <emilnovak
gmail.com>:
> Hi!
>
> The best way is already presented in PHP manual:
> http://www.php.net/oop . In this example you create an object, which
> you can - naturaly pass over Session, etc.
>
> If you'll use OOP (Object-Oriented Programming), it is preffered in
> PHP5 to use OOP5 (OOP for PHP5). You can find details on
> http://www.php.net/oop5 .
>
> Emil NOVAK, Slovenia, EU
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
On Sat, 2005-10-01 at 09:31, Emil Novak wrote:
> Hi!
>
> The best way is already presented in PHP manual:
> http://www.php.net/oop . In this example you create an object, which
> you can - naturaly pass over Session, etc.
>
> If you'll use OOP (Object-Oriented Programming), it is preffered in
> PHP5 to use OOP5 (OOP for PHP5). You can find details on
> http://www.php.net/oop5 .
While I would personally use OOP for a shopping cart, there is nothing
that indicates it is the "best" way. Anything that can be done using
objects can also be done procedurally using arrays. Additionally, PHP4
is quite sufficient for shopping carts versus necessarily moving to
PHP5. There are already many many shopping cart solutions implemented in
PHP4 thus PHP5 is obviously not a necessity even if it might be nice.
What the originally poster needed to know was how to go about it, and
yes the session is probably the route. The OP can also use permanent
cookies if supported by the visitor to remember the visitor upon
subsequent return, but this can also be facilitated with a login system
for registered members.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
attached mail follows:
On Sat, 2005-10-01 at 11:41, adriano ghezzi wrote:
> you need a db based approach, just setup a couple of tables in mysql
>
> items table
> one record per item
>
> current cart table
> one record per each item added to cart with unique session id
>
> order table
> one record per each item ordered with unique order id
>
> you'll transfer records here from current cart when user checkout
A DB approach is nice, but not necessary. Serialization of a shopping
cart array that contains the contents of the cart is sufficient. While a
DB is a natural solution, I've heard of systems that use the file system
or even email the request to a fulfillment address.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
attached mail follows:
depends imho there are a lot of reasons to use a db approach, unless
you are working on a really poor system,
first is persistent in any case you'll never lost an item
is the only way to make your software scalable to hundreds of users,
using array you have everything in memory, you must set up your
persistent system unless you trust a lot sessions that basically is a
file on disk
but as everything it's up to you
I really suggest you to go on db I can't see any disadvantage
bye
2005/10/1, Robert Cummings <robert
interjinn.com>:
> On Sat, 2005-10-01 at 11:41, adriano ghezzi wrote:
> > you need a db based approach, just setup a couple of tables in mysql
> >
> > items table
> > one record per item
> >
> > current cart table
> > one record per each item added to cart with unique session id
> >
> > order table
> > one record per each item ordered with unique order id
> >
> > you'll transfer records here from current cart when user checkout
>
> A DB approach is nice, but not necessary. Serialization of a shopping
> cart array that contains the contents of the cart is sufficient. While a
> DB is a natural solution, I've heard of systems that use the file system
> or even email the request to a fulfillment address.
>
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'
>
>
attached mail follows:
I don't think you are doing FTP. I think you mean uploading using an
upload form.
Just increase the threshold in the php.ini file or set it in the script.
Hope this helps.
On 9/30/05, Matt Palermo <mpalermo
vt.edu> wrote:
> Hello everyone. I'm basically building a PHP FTP client app. This app
> connects to an FTP server and allows the user to edit/delete
> files/permissions, etc. I've gotten to the point where I have started to
> create a file upload feature. The problem I have is that PHP only allows a
>
> 2mb maximum file upload, while normal FTP allows a much larger file to be
> uploaded. This app will be for a server where the user does not have access
>
> to change any php.ini settings. I'm basically looking for a way to upload
> large files (if needed) through my PHP FTP client app. This 2mb file limit
>
> is killing me here. Is there any way to get around this? I'm using the PHP
>
> built in FTP functions to do all the backend work for the app. I don't
> imagine there is an FTP function to use that will allow larger uploads is
> there? Please let me know if you have any suggestions. I really need to
> upload larger files, and since it's going to an FTP site, there shouldn't be
>
> too many size restrictions.
>
> Thanks,
>
> Matt
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Anas Mughal
attached mail follows:
Daevid Vincent wrote:
> Are you f'ing kidding me?!
>
> http://www.php.net/manual/en/ref.session.php
>
> "Some types of data can not be serialized thus stored in sessions. It
> includes resource variables or objects with circular references (i.e.
> objects which passes a reference to itself to another object). "
>
> L A M E !!!
>
> This is absurd. There shouldn't be any reason I can't send a reference to
maybe it's more absurd to try a stick DOM XML objects into the
session in the first place?
> another object -- Especially a built in type! UGH.
really why is that?
by all means write a patch that allows the serialization code
to serialize circular references. Though I imagine that it's
a little more difficult than it sounds.
then again you have __sleep() and __wakeup() magic methods which you
maybe able to use to 'shutdown' any references and 'bring them up' again.
btw I believe that the serialization code doesn't care whether objects
are 'built in' or not. it's purely a reference issue.
>
>
>>-----Original Message-----
>>From: Daevid Vincent [mailto:daevid
daevid.com]
>>Sent: Friday, September 30, 2005 3:02 PM
>>To: php-general
lists.php.net
>>Subject: [PHP] PHP5, $_SESSION, DOM XML objects not returning value
>>
>>I'm trying to store an array of DOM XML objects
>>(http://www.php.net/manual/en/ref.dom.php) in a PHP5.0.3
>>$_SESSION array,
>>but when I load the session back (and yes, I've declared my
>>class before the
>>session_start()), I get these errors:
>>
>>Warning: XMLRule::getValue() [function.getValue]: Invalid State Error
>>in /lockdown/includes/classes/rule_xml.class.php on line 74
>>
>>Or
>>
>>Warning: XMLRule::getValue() [function.getValue]: Invalid State Error
>>in /lockdown/includes/classes/rule_xml.class.php on line 81
>>
>>And all the VALUES are empty, however *my* XMLRule class
>>array seems right
>>otherwise. It's like PHP didn't serialize all of it's own DOM
>>XML objects
>>(which are built in objects!!!)
>>
>>Here are the pertinent parts of the classes and other code snippets.
>>
>>##############################################################
>>##############
>>#####
>>class XMLRule
>>{
>> // for example 'is_username' XML tag would set $name =
>>'Username'
>> protected $name = null;
>>
>> // The reference pointer to the DOMNode, this is a wealth of
>>information in itself.
>> // look at the DOMNode class
>>http://www.php.net/manual/en/ref.dom.php
>> protected $DOMNode = null;
>>
>> protected function __construct($DOMNode, $name, $id = null)
>> {
>> $this->DOMNode = $DOMNode;
>> $this->name = $name;
>> $this->id = $id;
>> } //__construct()
>>
>>
>> function getValue()
>> {
>> //check for multiple values, such as a list of
>>names perhaps
>>[#74] if ($this->DOMNode->childNodes->length > 1)
>> {
>> foreach ($this->DOMNode->childNodes as
>>$tmpNode)
>> $tmpArray[] = $tmpNode->nodeValue;
>> return $tmpArray;
>> }
>> else
>>[#81] return $this->DOMNode->nodeValue;
>> }
>>}
>>
>>class is_username extends XMLRule
>>{
>> function __construct($DOMNode, $id = null) {
>>parent::__construct($DOMNode, 'Username', $id); }
>>}
>>
>>class is_day extends XMLRule
>>{
>> function __construct($DOMNode, $id = null) {
>>parent::__construct($DOMNode, 'Day', $id); }
>>}
>>
>>...etc...
>>
>>##############################################################
>>##############
>>#####
>>
>>// IMPORTANT: You *MUST* declare the class *BEFORE* you call
>>session_start().
>>// If you run session_start() before the definition of the class,
>>// the session variables of the objects will be corrupted.
>>// http://www.zend.com/phorum/read.php?num=3&id=36854&thread=36847
>>
>>require_once('classes/rule_xml.class.php');
>>
>>if (!isset($_SESSION['ruleArray']))
>>{
>> $XMLDOC = new DOMDocument();
>> $XMLDOC->loadXML($xmlstring);
>>
>> $ruleArray = array();
>> $i = 1;
>> $or = 1;
>> foreach($XMLDOC->firstChild->childNodes as $myNode)
>> {
>> if ($myNode->nodeName == 'and_conditions')
>> {
>> foreach($myNode->childNodes as $cNode)
>> {
>> $key = (string)($cNode->nodeName);
>> //make a new instance of the node name'd
>>class
>> $ruleArray[$or][$i] = new
>>$key($cNode, $i);
>> $i++;
>> }
>>
>> $or++; //begin new OR block
>> } //if and_conditions
>> } //foreach $myNode
>>
>> $_SESSION['ruleArray'] = serialize($ruleArray);
>>}
>>else $ruleArray = unserialize($_SESSION['ruleArray']);
>>
>>I've tried this with the un/serialize and without. PHP5 is supposed to
>>handle that for me, but just in case, I tried it anyways.
>>
>>If I don't use the $SESSION, then things work fine and I have
>>my values.
>>
>>I also tried to do this:
>>
>> $_SESSION['ruleArray'] = $ruleArray;
>> $ruleArray = $_SESSION['ruleArray'];
>>
>>And surprisingly that works (although it doesn't solve my problem).
>>
>>##############################################################
>>##############
>>#####
>>Upon loading this back, this is what the array looks like in
>>either case
>>(working or not)
>>
>>Array
>>(
>> [1] => Array
>> (
>> [1] => is_username Object
>> (
>> [name:protected] => Username
>> [DOMNode:protected] => DOMElement Object
>> (
>> )
>> [id:protected] => 1
>> )
>>
>> [2] => is_day Object
>> (
>> [name:protected] => Day
>> [DOMNode:protected] => DOMElement Object
>> (
>> )
>> [id:protected] => 2
>> )
>>
>> ...etc...
>>
>>##############################################################
>>##############
>>#####
>>
>>PHP Version 5.0.3
>>
>>This program makes use of the Zend Scripting Language Engine:
>>Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
>> with Zend Extension Manager v1.0.6, Copyright (c)
>>2003-2004, by Zend
>>Technologies
>> with Zend Optimizer v2.5.7, Copyright (c) 1998-2004, by Zend
>>Technologies
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
attached mail follows:
hello all,
I have noticed on this server/talk/chat I am trying to write, that when i
or another user logs on, right away, it will go to the if statement in my
chat handling function, that says something to the affect of /* something
entered but not a . */
if(($words[0] != '.' ) && count($words) == 1)
{
socket_write($sock, "$user said $words[0]");
}
/* end of if */
and when i log on, it will automatically hit that last if statement like
there is something still in the buffer and it seems to be a blank space or
maybe its a new line or something, but I have ob_implicit_flush(); called
before any of the code but shouldnt that take care of all buffers, or just
the output buffer?
if so, how do I make sure the "input buffer" is emptied every time
i think this is the reason I am having a problem with new variables not
being filled with anything, the code doesn't even wait, it apparently is
some big code problem on my part or i just need to somehow clear the input
buffer, which i assume is just stdin,
do i need something like flush($sock); or did i just hit the nail on the
head with that question
matt
attached mail follows:
I have the following class
class CMAES_DomIterator implements RecursiveIteratorIterator
{
....
}
When I am instanciating the class I am getting the following error:
Fatal error: CMAES_DomIterator cannot implement
RecursiveIteratorIterator - it is not an interface ...
Does not PHP 5.0.5 support the RecursiveIteratorIterator Interface?
Thanxs
/Erik
attached mail follows:
Erik Franzén schrieb:
> Fatal error: CMAES_DomIterator cannot implement
> RecursiveIteratorIterator - it is not an interface ...
>
> Does not PHP 5.0.5 support the RecursiveIteratorIterator Interface?
No, it doesn't. Like it tells you: RecursiveItraorIterator is no an
interface. It's a class. You can extend it but not implement it.
Further info here:
http://www.php.net/~helly/php/ext/spl/
AllOLLi
____________
Buffy: "The Slayer.. The chosen one. She-who-hangs-out-a-lot-in-cemeteries."
[Buffy 411]
attached mail follows:
Hello,
I need to implement a client for Web services. My first option is to use SOAP,
but it seems that the pear SOAP package is still in beta. Do you think it's
ready for a production quality site? If not, what are my other options? What
do people use in this case?
Thank you.
RDB
attached mail follows:
you could try the native SOAP extension in php5.
A client asked me about this recently and I told him I thought he
should use java / axis because of problems with PHP / SOAP
specifically as it relates to handling certain data types.
-jonathan
On Oct 1, 2005, at 1:49 PM, Reuben D. Budiardja wrote:
> Hello,
> I need to implement a client for Web services. My first option is
> to use SOAP,
> but it seems that the pear SOAP package is still in beta. Do you
> think it's
> ready for a production quality site? If not, what are my other
> options? What
> do people use in this case?
>
> Thank you.
> RDB
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
attached mail follows:
Hello,
On Saturday 01 October 2005 17:13, jonathan wrote:
> you could try the native SOAP extension in php5.
>
> A client asked me about this recently and I told him I thought he
> should use java / axis because of problems with PHP / SOAP
> specifically as it relates to handling certain data types.
>
> -jonathan
I've looked at the php.net and saw "(no version information, might be only in
CVS)" in the docs. So is this already in the released version of PHP 5 or
not ?
I haven't been exactly following with what's going on in PHP 5. I already have
my applications working and it was written and run with PHP 4. This SOAP part
is an extension to try to integrate my apps with other apps (ie.
authentication) in the company I am working for. If SOAP is natively
supported in PHP 5 and better (and faster) than the PEAR extension, then
maybe it's worth my efforts to migrate to PHP 5. But otherwise, I am rather
reluctant to fix what's not broken (ie. upgrading to PHP 5) since that means
I have to install PHP 5 and reconfigure the webserver again.
Thanks for any comments, suggestions, or opinions.
RDB
attached mail follows:
Frank Keessen schrieb:
> Can you please help me with the following
> This is in the array($info[0]["bdnadvocaat"])
> Array ( [count] => 2 [0] => 210 [1] => 149 )
> This is the code:
> $testje=array($info[0]["bdnadvocaat"]);
> $test=array_shift($testje);
> print_r($test);
> This is the output
> Array ( [count] => 2 [0] => 210 [1] => 149 )
> How can i remove the 'count' from the array?
array_shift works "in situ", it operates on the array insted of
returning a new one. Also you are using array(), whichs builds an array
of its argument(s). Suppose you have
Array ( [count] => 2 [0] => 210 [1] => 149 )
in $info[0]["bdnadvocaat"]. Then $testje=array($info[0]["bdnadvocaat"]);
will result in having
Array ( [0] => Array( [count] => 2 [0] => 210 [1] => 149 ))
in $testje. An array with just one value! Afterwards doing
$test=array_shift($testje); will remove the first element from $test and
give it as result. Afterwards you have
$test == Array ( [count] => 2 [0] => 210 [1] => 149 )
$testje == Array ( )
If you simply want to remove the first element from
$info[0]["bdnadvocaat"], you can simply
array_shift($info[0]["bdnadvocaat"])
which removes count.
AllOLLi
____________
"That fact was conveniently omitted."
[Enterprise 409]
attached mail follows:
To be brief I would like to know if Indexdata's PHP/YAZ is compatible
with PHP 5.0.3 and if so what steps may be taken taken to build it.
The configure file that comes with PHP 5.0 contains no mention of yaz
so how does one build PHP (and the php_yaz.so) short of adding the
configure information from the 4.4 configure file and munging until
it builds?
I have already built the yaz 2.0 libs and bins and can use the yaz-
client so it is a matter of building the PHP extension at this point.
I would like not to have to go back to 4.4 for this functionality.
Thank you,
-m
attached mail follows:
Hi,
I'm working on a script which basically loads an image, the user
requested and wonder how to properly sanitize the passed path. For
instance the user should never ever be able to do somtehing
like ?load=../../../etc/passwd.
My approach so far is to simply urldecode() the given string and return
an error if ".." is found in it. Maybe I'm a little paranoid but is this
really enough?
For clarification: All paths are prefixed with some kind of a root path.
All images within this root path may be accessed but "jumping" out of it
should not be allowed.
Regards,
Niels.
attached mail follows:
> I'm working on a script which basically loads an image, the user
> requested and wonder how to properly sanitize the passed path. For
> instance the user should never ever be able to do somtehing
> like ?load=../../../etc/passwd.
>
> My approach so far is to simply urldecode() the given string and return
> an error if ".." is found in it. Maybe I'm a little paranoid but is this
> really enough?
>
> For clarification: All paths are prefixed with some kind of a root path.
> All images within this root path may be accessed but "jumping" out of it
> should not be allowed.
realpath() is your friend... prepend your root path to the passed in
string, then run that through realpath, then verify that your root path is
still prepended...
http://us2.php.net/realpath
realpath() expands all symbolic links and resolves references to '/./',
'/../' and extra '/' characters in the input path and return the
canonicalized absolute pathname. The resulting path will have no symbolic
link, '/./' or '/../' components.
realpath() returns FALSE on failure, e.g. if the file does not exist. On
BSD systems realpath() doesn't fail if only the last path component
doesn't exist, while other systems will return FALSE.
attached mail follows:
Thanks for your reply, Philip.
> realpath() is your friend...
That has been my first impression too, but...
> realpath() expands all symbolic links
I am actually using symlinks :)
I trust the files on my server so "local redirects" via symlinks are no
problem, the user submitted data is.
Regards,
Niels.
attached mail follows:
The transformation is not returning anything new, just the comment
segment as it was before sending it to rdfpic2html. I am trying to
modify http://www.ozhiker.com/electronics/pjmt/ PJMT's JPEG.php to
transform http://jigsaw.w3.org/rdfpic/ rdfpic xml in the comment
segment of jpegs and return it to Example.php
function Interpret_Comment_to_HTML( $jpeg_header_data )
{
// Create a string to receive the output
$output = "";
// read the comment segment
$comment = get_jpeg_Comment( $jpeg_header_data );
// Check if the comment segment was valid
if ( $comment !== FALSE )
{
// Check if the string contains an indicator that there may be
rdfpic metadata
if (stristr($comment, 'PhotoRDF') !== FALSE)
{
$rdfpicdata = stristr($comment, '<?xml');
rdfpic2html( $rdfpicdata );
$output .= "<h2 class=\"JPEG_Comment_RDFPIC_Heading\">JPEG
RDFPIC Metadata</h2>\n";
$output .= "<p
class=\"JPEG_RDFPIC_Text\">$rdfpichtml</p>\n";
}
// Comment exists - add it to the output
$output .= "<h2
class=\"JPEG_Comment_Main_Heading\">JPEG Comment</h2>\n";
$output .= "<p
class=\"JPEG_Comment_Text\">$comment</p>\n";
}
// Return the result
return $output;
}
function rdfpic2html( $rdfpicdata )
{
$arguments = array('/_rdf' => $rdfpicdata);
$xsltproc = xslt_create();
xslt_set_encoding($xsltproc, 'ISO-8859-1');
$rdfpichtml = xslt_process($xsltproc, 'arg:/_rdf', 'rdfpic.xsl',
NULL, $arguments);
// $Toolkit_Dir/$rdfpicxsl not working ? why
if (empty($rdfpichtml)) {
die('XSLT processing error: '. xslt_error($xsltproc));
}
xslt_free($xsltproc);
// echo $rdfpichtml; this returns the correct data to the browser but
not when and where I want it
return $rdfpichtml;
}
rdfpic.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#"
xmlns:DC="http://purl.oclc.org/dc/documents/rec-dces-199809.htm#"
xmlns:Technical="http://www.w3.org/2000/PhotoRDF/technical-1-0#"
xmlns:s0="http://www.w3.org/2000/PhotoRDF/technical-1-0#"
xmlns:s1="http://www.w3.org/2000/PhotoRDF/dc-1-0#"
xmlns:s2="http://sophia.inria.fr/~enerbonn/rdfpiclang#"
version="1.0">
<xsl:comment>is REC-html40 better/more recent?
xmlns="http://www.w3.org/1999/09/28-Photo-ns#"</xsl:comment>
<xsl:output method="html" indent="no"/>
<xsl:comment>These are the only namespaces I have seen used. This is a
catch all template for
all these namespaces and nodes</xsl:comment>
<xsl:template match="DC:*|Technical:*|s2:*|s1:*|s0:*">
<br /><xsl:value-of select="local-name()"/>:
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
xml array data is:
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/1999/09/28-Photo-ns#"
xmlns:DC="http://purl.oclc.org/dc/documents/rec-dces-199809.htm#"
xmlns:Technical="http://www.w3.org/2000/PhotoRDF/technical-1-0#">
<rdf:Description about="for awhile">
<DC:Description>Take one</DC:Description>
<DC:Type>image/jpeg</DC:Type>
<DC:Subject>computers</DC:Subject>
<DC:Source>ccd</DC:Source>
<DC:Rights>public domain</DC:Rights>
<DC:Title>Lets get this working</DC:Title>
<DC:Date>2005-04-20</DC:Date>
<DC:Coverage>USA</DC:Coverage>
<DC:Creator>Me</DC:Creator>
<Technical:devel-date>2005-05-01</Technical:devel-date>
<Technical:lens>Minolta AF70-210</Technical:lens>
<Technical:camera>Minolta800i</Technical:camera>
<Technical:film>Fuji</Technical:film>
</rdf:Description>
</rdf:RDF>
Aloha, Eric
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]