Topic: Php xml class

Hi all,

I need to make a web with differents languages. I will do it in xml but I need a free xml class that works fine.

You know some class that I can use free?

I decided to use xml because I think it's more quick than database. If I'm wrong please post thanks

Re: Php xml class

You need a class to parse XML? SimpleXML, DomDocument.. those are PHP modules, very quick even with huge files and the API is pretty straightforward... but I'd rather suggest you to use text-files. Have a look at Smarty and the way they utilize the language configs. It's very easy and quick...

Re: Php xml class

I q_no,

I know about Smarty but some people dislike it. You can read a little opinion about Smarty here.

I think plain text files are more quick than xml but the information can't be ordered correctly because You don't have a reference for a variable...or im wrong?

for example:

xml...
<tag_name_example>raisseN</tag_name_example>
plain text...
raisseN

How you do to take a key for a var¿?

Thanks for your answer q_no see you.

Re: Php xml class

lol. thanks for posting a spanish link tongue

Well.. you could read the text-file, split by "\n" and "=" and assign the keys to variables, like Smarty does... wink

$lang_file = file_get_contents('en.conf');
$lines = explode("\n",$lang_file);
$vars = array();
foreach ($lines as $line) {
  list($key,$value = explode("=");
 $vars[trim($key)]=trim($value);
}

and your language files could look like this:

englisch file:

headline = Welcome

german file:

headline = Willkommen

spanish

headline = Hola!

portuguese:
headline = bom dia!

Hope you got my point! wink (and yes.. my spanish and portguese is bad) big_smile

Re: Php xml class

I just translated that link to english with Google translate and cannot agree with it.

In the latest site I have been working I do everything - program, style, html, javascript, jQuery, etc.

The site is an extremely interactive business site and having the visual separate from the logical saves
me a lot of time keeps things clean.

One complaint about Smarty is that it is recompiled whenever a template is changed. You and your users will never know it has happened.

Another was that you have no control over the generated PHP code. Who cares? It is very fast and efficient and never causes any perceptable delays.

I used to think Smarty was a bit of an overkill until I really put it into use.

Try it. You'll love it.

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: Php xml class

Hey ed and q_no thanks for your replys.

I don't have a lot of time now but I try to use Smarty... Thanks for your code q_no and sorry for Spanish link I was slept xD

Re: Php xml class

Some php xml scripts listed on the page!
Hopefully can help you!