Keyword

Loading xml in category_item.php

  • Vitaly
  • Vitaly's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 10 months ago #107057 by Vitaly
Loading xml in category_item.php was created by Vitaly
Hello there.

I have a problem. Can someone tell me loading steps of k2 category list?

Because I need to take some data from currency xml. If I load that xml from any other php(from main template for instance) it load perfectly fast but I cant take any variables from there.

If I load xml in category_item.php, page loads very slowly. I mean VERY. It's like 5 secs on local server. Why does this happen?

Can someone help me? How can I load some xml data into category_item without increasing loading time so much?

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #107058 by william white
Replied by william white on topic Re: Loading xml in category_item.php
Not sure exactly what your doing but this example code
www.w3schools.com/php/php_xml_simplexml.asp
will work and load instantly on my localhost wtih latest j 3.x version and k2 2.6.2 in both category_item.php and item.php

Please Log in or Create an account to join the conversation.

  • Vitaly
  • Vitaly's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 10 months ago #107059 by Vitaly
Replied by Vitaly on topic Re: Loading xml in category_item.php
Let me explain more fully.

I know how to load xml file and it works perfectly.

In my case problem is loading time of my page.

This is how my k2 works:

Loading catalog page (category.php), then loading few extra fields from every item in this category (category_item.php)

One of the fields is a price. Its not always in currency I need so I need to change it but not in the field itself. I just need to modify the result. So my solution was to take currency from my central bank and change the result.

But! If I will load xml with currencies in category_item.php it will effect on page loading time(because I need to load xml every time script take some fields for every item in that category). That's about 60+ times.

So I need to ask k2 community - how can I load xml only 1 time, but use its variables every time category_item.php will be called? And use that variables inside category_item.php code.

Sorry for my English again.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum