Re: [PHP] Re: Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-04 Thread Richard Quadling
On 3 April 2011 21:38, Peter Lind peter.e.l...@gmail.com wrote:
 On 3 April 2011 22:35, Andre Polykanine an...@oire.org wrote:
 Hello Peter,

 Thanks a lot! And is there a way to set (write) custom values in files
 other than php.ini? Sorry, didn't find such a function.


 I haven't come across any, but then again, I haven't had the need so
 never looked much ... It would be rather easy to generate though

 Regards
 Peter

 --
 hype
 WWW: plphp.dk / plind.dk
 LinkedIn: plind
 BeWelcome/Couchsurfing: Fake51
 Twitter: kafe15
 /hype

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



For a truly quick and dirty config, then just use PHP.

A similar mechanism is used by PhD - the PHP Documentation building tool.

?php
// Create default config
$config = array('item1' = 'value1');

// Load the saved config.
$loadedConfig = include './config.inc';

// Merge configs.
$config = array_merge($config, $loadedConfig);

// Manipulate config.
$config['item1'] = 'value2';

// Save config.
file_put_contents('./config.inc', '?php return ' .
var_export($config, true) .';');
?



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Jason Pruim
So the subject says it all... And yes I know this isn't related to PHP but it's 
the weekend and I trust the opinions on this list more then any other list I 
have seen. I've been doing alot of reading on XML and honestly it looks pretty 
cool... BUT the question is... Is it truly useful or is it just another layer 
that we have to write?

From what I can tell it looks like it could stabilize some of my programming in 
regards to databases, and possibly if I have to move information from one 
application to another.

But is it worth the added coding or should I just interact with the pieces 
directly?

Thoughts? Questions? Flames? :)



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Ashley Sheridan
Jason Pruim li...@pruimphotography.com wrote:

So the subject says it all... And yes I know this isn't related to PHP
but it's the weekend and I trust the opinions on this list more then
any other list I have seen. I've been doing alot of reading on XML and
honestly it looks pretty cool... BUT the question is... Is it truly
useful or is it just another layer that we have to write?

From what I can tell it looks like it could stabilize some of my
programming in regards to databases, and possibly if I have to move
information from one application to another.

But is it worth the added coding or should I just interact with the
pieces directly?

Thoughts? Questions? Flames? :)



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Personally I've always considered xml as a format only for transferring data. A 
lot of popular file formats are xml-based, such as the open office formats. 
Then there's things like xhtml, svg, etc which are all xml formats. Property 
thought out, xml can be used very well for internal or proprietary formats. If 
you need a guide on how not to do it, search the daily wtf archives for xml!


Thanks
Ash
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Per Jessen
Jason Pruim wrote:

 So the subject says it all... And yes I know this isn't related to PHP
 but it's the weekend and I trust the opinions on this list more then
 any other list I have seen. I've been doing alot of reading on XML and
 honestly it looks pretty cool... BUT the question is... Is it truly
 useful or is it just another layer that we have to write?

I started looking at XML about 8-9 years ago and at first dismissed it
as just another way to gobble up CPU-cycles.  Later on, I began to
appreciate some of the really cool stuff you can achieve with XSLT, and
today I would not want to be without XML. 


-- 
Per Jessen, Zürich (16.6°C)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Peter Lind
Like every other technology, XML needs to have a use before it becomes
a useful tool. Just using XML because it's available quickly leads to
headaches, as it isn't the best tool for all scenarios (config files
written in XML for instance). That said, XML is awesome for a lot of
things ... however, without having a better grasp of XML you're
unlikely to know whether it'll fit your needs.

If for no other reason, learning XML and related technologies is worth
it simply because the rest of the world uses it. So get to know it,
then you'll be able to actually judge if your project can benefit from
it.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-03 Thread Andre Polykanine
Hello Peter,

Just because you mentioned config files.
What  would  you suggest me as better format for them? Database is not
available  yet  since  I  need to make a config file before creating a
database.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Peter Lind peter.e.l...@gmail.com
To: Per Jessen
Date created: , 10:27:09 PM
Subject: [PHP] XML... Useful or another layer of complexity?


  Like every other technology, XML needs to have a use before it becomes
a useful tool. Just using XML because it's available quickly leads to
headaches, as it isn't the best tool for all scenarios (config files
written in XML for instance). That said, XML is awesome for a lot of
things ... however, without having a better grasp of XML you're
unlikely to know whether it'll fit your needs.

If for no other reason, learning XML and related technologies is worth
it simply because the rest of the world uses it. So get to know it,
then you'll be able to actually judge if your project can benefit from
it.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-03 Thread Peter Lind
On 3 April 2011 21:41, Andre Polykanine an...@oire.org wrote:
 Hello Peter,

 Just because you mentioned config files.
 What  would  you suggest me as better format for them? Database is not
 available  yet  since  I  need to make a config file before creating a
 database.

For config files I would suggest plain text config files - in the style of

key = value

php has built-in functions for reading those, so parsing them is very
fast and easy. See
http://dk2.php.net/manual/en/function.parse-ini-file.php

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Camilo Sperberg

El 03-04-11 14:41, Jason Pruim escribió:

So the subject says it all... And yes I know this isn't related to PHP but it's 
the weekend and I trust the opinions on this list more then any other list I 
have seen. I've been doing alot of reading on XML and honestly it looks pretty 
cool... BUT the question is... Is it truly useful or is it just another layer 
that we have to write?

 From what I can tell it looks like it could stabilize some of my programming 
in regards to databases, and possibly if I have to move information from one 
application to another.

But is it worth the added coding or should I just interact with the pieces 
directly?

Thoughts? Questions? Flames? :)
I think it is pretty useful, not for internals, but to communicate with 
other apps such as Adobe Flash or any other system which involves 
trespassing information.


SimpleXML is very easy to work with, you'll only need a valid XML file 
to read in case of reading. If you need CDATA support, SimpleXML can be 
extended with this:

http://coffeerings.posterous.com/php-simplexml-and-cdata

Greetings.

--
unreal4u.com http://unreal4u.com/
CHW http://www.chw.net/
Mi Twitter http://twitter.com/unreal4u


Re: [PHP] XML... Useful or another layer of complexity?

2011-04-03 Thread Jason Pruim

On Apr 3, 2011, at 3:31 PM, mrfroasty wrote:

 On 04/03/2011 08:41 PM, Jason Pruim wrote:
 
 So the subject says it all... And yes I know this isn't related to PHP but 
 it's the weekend and I trust the opinions on this list more then any other 
 list I have seen. I've been doing alot of reading on XML and honestly it 
 looks pretty cool... BUT the question is... Is it truly useful or is it just 
 another layer that we have to write?
 
 From what I can tell it looks like it could stabilize some of my programming 
 in regards to databases, and possibly if I have to move information from one 
 application to another.
 
 But is it worth the added coding or should I just interact with the pieces 
 directly?
 
 Thoughts? Questions? Flames? :)
 
 
 
 Not sure about specific situations, but if I have to write my own application 
 to application data transfer i wouldnt add such a complexity.I would just 
 create my own data like objects/arrays serialized and send them over via http 
 post or any easy means.And i will be done in few minutes, problem solved!.
 
 I have once created orders in xml for myself and send over via ftp to another 
 application.But this was just due to a fact that I had the scripts in place 
 to do the job.It looks much matured though, than if I had transfer the orders 
 in text format.
 
 But as I said, this depends on particular situations and problem on the 
 table.All cases where I worked with xml, were me receiving data from client 
 either via soap,xml files etc.Here I have no choice I have to work with xml 
 ofcourse.
 
 P:S
 **How could you stabilize your scripts by adding xml ?
 

I was thinking along the lines of using it as a intermediary.. Basically make a 
system that would take my raw data, throw it into XML, and then out to the web, 
database, or something else I haven't thought of.. If I was going into database 
I could create an abstraction layer using XML and format all the data before 
inserting it into specific fields... 

Now that I typed it I'm not sure it would work like I want it to But that 
was my thinking at the time.

Although I could write a system that would generate the XML from content in a 
database and then parse it as an rss feed, and insert it into a calendar 
system... (If that was needed)

Right now the question is purely academic  so I'm coming up with this stuff as 
I'm typing hehe :)




Re: [PHP] Re: Config files: what is best? (was: Re: [PHP] XML... Useful or another layer of complexity?)

2011-04-03 Thread Peter Lind
On 3 April 2011 22:35, Andre Polykanine an...@oire.org wrote:
 Hello Peter,

 Thanks a lot! And is there a way to set (write) custom values in files
 other than php.ini? Sorry, didn't find such a function.


I haven't come across any, but then again, I haven't had the need so
never looked much ... It would be rather easy to generate though

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php