📜 ⬆️ ⬇️

Parser. Practical use

Just before the new year, one Lebedev announced in the Studio news that a new version of Parser had been released . Immediately after that, someone fuksito fuksito posted the topic “ Object-Oriented Language from the“ Art. Lebedev Studio ” ”. The topic caused a heated discussion: someone just spoke, someone managed to lower his neighbor below the plinth, someone ... In general, the atmosphere heated up for the most undesirable.

So, in order not to say something like “ I read the news. Read the comments. 160 pages of manual. I came to the conclusion -> Complete shit, ”I sat back in my chair, fiddled with real estate to find the most comfortable position for a long sitting, and began to read Parser’s documentation.

My verdict? (The hall stood waiting.) It's simple - I found for myself the practical application of this wonderful template engine, as it was already managed to christen.
')

Practical use

A couple of months ago, my friend told me about Geymboss affiliate program (I deliberately did not put up links), and I am a reckless person for all sorts of inventions, and all this time I was tormented by the desire to do something with her. Something that turned out to be the desire to customize the affiliate XML jerk to generate static HTML from it. To do this in PHP, how to send two bytes, but I didn’t like the fact that the entire file structure, at the same time, will be generated on the fly and even stupidly put a counter on the page - another hemorrhage. I think you already understand what I'm getting at :-)

Step one
I wrote a small PHP script that pulls the XML from the games directory and puts the necessary pieces into the necessary HTML files. The script is in PHP, because in it I understand much more than in Parser.

Step Two
I installed Parser on the most common hosting . By the way, if my Internet provider were not buggy (hello, Novotelecom!), And I would be better aware of installing anything on the server - the installation would take about 10 minutes.

Step Three
I uploaded to the server the necessary files for the site’s work and the XML script itself.

Step Four
I started the script and corrected something by the results of its work. Yes, I had to, because Vindous is on the local server, and on the live Linux.

Step five
In two places - the auto.p file for the main page and for the game pages - set up the site design. The parser is going to the header, menu, body, and footer of the page.

Total

Got what I wanted: static HTML with the ability to quickly make changes to the design of the pages. View a working site? Please play.likegroof.ru .

I am sure that the dergalka can also be written on Parcer, but I didn’t dive so deep. And why? The set of knowledge necessary for my task I received and did what I wanted using two different technologies. I'm happy :-)

Literary bonus!

Taught me something
Children of their nature mother.
Who can not create anything
He knows how to criticize.

Igor Guberman, Gariki

Source: https://habr.com/ru/post/18374/


All Articles