php-general Digest 13 Feb 2005 10:07:00 -0000 Issue 3283

Topics (messages 208589 through 208597):

SimpleXML & internal entity references
        208589 by: Rolf Brudeseth

Artificial Intelligence for PHP
        208590 by: C.F. Scheidecker Antunes

Re: Advice/opinion requested on page section lineup
        208591 by: Jochem Maas
        208593 by: Alp
        208594 by: Burhan Khalid

Re: Minimalist permissions
        208592 by: Jason Wong

inheriting from non similar types?
        208595 by: D_C
        208596 by: Burhan Khalid

Re: Checking the Version of mySql and settings on server
        208597 by: Burhan Khalid

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message --- I have spent quite a few hours searching with google, but I am still not sure how to resolve my problem described below:

I am parsing an XML file with SimpleXML (PHP 5.0.3/FreeBSD STABLE-4/i386). It appears that my internal entity references do not get expanded. I see the same behaviour with SAX and PHP5.0.3, while it was not a problem with SAX and PHP4.1.2.

See below, the 'title' gets added to the array, but not the 'price' and 'weight'.

I assume that libxml will expand the entity references? I see the value of 'price' and 'weight' of I look at the data returned by the parser with 'print_r'.

Anybody got an idea where I have gone wrong?

##########   XML file   ##########
<?xml version='1.0' encoding='iso-8859-1' standalone='yes'?>

<!DOCTYPE prod_desc
[
<!ENTITY dvd '
  <price>14.95</price>
  <weight>6</weight>
'>
]>

<prod_desc version='1.0'>
  <prod item='C107D'>
     &dvd;
     <title><![CDATA[No more Diapers - DVD]]></title>
  </prod>
</prod_desc>

########## PHP code ##########
foreach ($xml->children() as $item)
{
$item_attr = $item->attributes();
foreach ($item->children() as $element => $cdata)
{
// This will not work, bug in PHP
// $prod_array[$item_attr][$element] = $cdata;
// Workaround
$prod_array[eval("return $item_attr;")][eval("return $element;")] = $cdata;
}
}


Rolf

--
Rolf Brudeseth
Software Developer
Personalized Book Shop
[EMAIL PROTECTED]
www.personalized-books.com

--- End Message ---
--- Begin Message ---
Hello,

I am interested on Artificial Intelligence for PHP, pattern maching, etc.
More specifically: data mining, statistics and pattern maching.

Couple of years ago there was a presentation on the MELL Extension - AI for PHP.

I've tried to google it but I've found no code or examples.

Does anyone have any knowledge on using PHP for AI systems or know of any resource, a book
or on the internet that might help me out?


Thanks in advance,

C.F.
--- End Message ---
--- Begin Message ---
Alp wrote:
...

I would like to be able to alter the lining-up of several sections on a php generated webpage. What would be the best/optimal approach in achieving that?

As an example "sections" referred to are mostly tables generated via code on
data obtained from a DB. Should I name them (somehow), shall I use a
seperate table to store the lining-up information or shall I add a
"precedence" integer column to each relevant table in the database, ...?


sorry, driveby answer.
you want to make your output (source) HTML look pretty?
2 options spring to mind:
1. the Tidy extension (there are probably other similar tools)
2. don't bother - as long as its syntax is correct indentation
is irrelevant really.

or do you mean something else by 'line-up'?


Thanks in advance for your guidance.

Alp


--- End Message ---
--- Begin Message ---
Hi Jochem,

Intention is to give a user the option of assigning "position" of a
"section" on the page, i.e:
First: sectA, then sectC, then sectE, then sectB and sectD.... or any other
order that is indicated by the user. So it is somewhat like top-of-page,
mid-of-page etc but with a numbering/precedence/sorting (can be named any)
system that populates the page according to the choice.
Roughly:
<--first section-->
<--second section-->
<--third section-->
<--fourth section-->
<--fifth section-->
etc... Clearer now?

Alp

"Jochem Maas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Alp wrote:
> ...
> >
> > I would like to be able to alter the lining-up of several sections on a
php
> > generated webpage. What would be the best/optimal approach in achieving
> > that?
> >
> > As an example "sections" referred to are mostly tables generated via
code on
> > data obtained from a DB. Should I name them (somehow), shall I use a
> > seperate table to store the lining-up information or shall I add a
> > "precedence" integer column to each relevant table in the database, ...?
>
>
> sorry, driveby answer.
> you want to make your output (source) HTML look pretty?
> 2 options spring to mind:
> 1. the Tidy extension (there are probably other similar tools)
> 2. don't bother - as long as its syntax is correct indentation
> is irrelevant really.
>
> or do you mean something else by 'line-up'?
>
> >
> > Thanks in advance for your guidance.
> >
> > Alp
> >

--- End Message ---
--- Begin Message --- Alp wrote:
Hi Jochem,

Intention is to give a user the option of assigning "position" of a
"section" on the page, i.e:
First: sectA, then sectC, then sectE, then sectB and sectD.... or any other
order that is indicated by the user. So it is somewhat like top-of-page,
mid-of-page etc but with a numbering/precedence/sorting (can be named any)
system that populates the page according to the choice.
Roughly:
<--first section-->
<--second section-->
<--third section-->
<--fourth section-->
<--fifth section-->

Alp:

You can implement a weights system, similar to Drupal. In such a system, each item is given a weight -- the lighter the item floats to the top, and the heavier items sink to the bottom. Weights can range from anything (lets take -10 to 10 -- 0 being the default). 1 is "heavier" than 0, so any item with a weight of 1 sinks below any item with a weight < 1. -1 is lighter than 0, so it will float above both 0 and 1.

This type of system is good if you are not concerned with strict placing of items, since two items in the same weight category are simply stacked on top of each other.

Regards,
Burhan

--- End Message ---
--- Begin Message ---
On Saturday 12 February 2005 11:28, Ugo Bellavance wrote:

>      Please forgive me if this specific question has already been
> addressed, but I'm doing tests to figure out what are the minimal
> permissions I can give on my files and folders for a PHP application
> and I just can't find it (even by searching this list).  Feel free to
> redirect me to existing documentation that I woule have missed, if
> needed.

http://marc.theaimsgroup.com/?l=php-general&m=105793487024873&w=2

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
Hiya -

I want to create a class that inherits from a database object.

eg I have my own "user" Class, with general methods that do calculations etc.
However, it also reflects a table of the database, eg "age, location".

I want some methods called on the object to be handled by my class, but other 

so at constructor time, something like

$this->parent = mysql_fetch_object($res); // returns a mysql obj with
age, loc etc records

then ...

$age = $userObj->age;   // this actually comes straight from the dbase obj
$rating = $userObj->rating;   // a public var calculated at construction
$life = $userObj->getSpend();  // this is a method to do a calc.

I could use a component (is the right OOP pattern word?)
$age = $userObj->dbObj->age  

but I wanted to hide where the items are coming from. Also i want to
be able to just keep adding to the database without having to create
gettter/settter functions for everything...

I think python had some nice means of doing get/set functions
transparently, does PHP5 have anything like this?

thanks!

/dc
-- 
_______________________________________________
           David "DC" Collier
mobile business creator ïãããããããããããããããã
           [EMAIL PROTECTED]
           skype: d3ntaku
           http://www.pikkle.com
           +81 (0)90-7414-6107

--- End Message ---
--- Begin Message ---
D_C wrote:
 > $this->parent = mysql_fetch_object($res); // returns a mysql obj with
age, loc etc records

then ...

$age = $userObj->age;   // this actually comes straight from the dbase obj
$rating = $userObj->rating;   // a public var calculated at construction
$life = $userObj->getSpend();  // this is a method to do a calc.

I could use a component (is the right OOP pattern word?)
$age = $userObj->dbObj->age

I believe the correct term for this is an object.


but I wanted to hide where the items are coming from. Also i want to be able to just keep adding to the database without having to create gettter/settter functions for everything...

I think python had some nice means of doing get/set functions
transparently, does PHP5 have anything like this?

PHP5 does have get and set functions ( http://www.php.net/manual/en/language.oop5.overloading.php ) however, your problem might be extrapolating all the properties of the object, because if you change your database structure, then you wil have new properties in $dbObj.

--- End Message ---
--- Begin Message --- Marek Kilimajer wrote:
GH wrote:

However, this does not tell you if they are using the Old or New
Password on the newer version... how can i check that?

If you can connect with mysql_connect(), its using the old password switch.

--- End Message ---

Reply via email to