Output view as plain text or XML file

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
11 years 3 months ago #158840

-- HikaShop version -- : uptodate
-- Joomla version -- : uptodate
-- PHP version -- : uptodate
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message

I created a product view with tablelist.php taht generates a XML sequence. I do output this view through a very clear clean template but anyhow I get html format output. The <xml tags> can't be seen also on screen although they are in the source code.

How in HikaShop or Joomla can I make the view output as plaintext so I can directly copy it from the browser or save the content as an XML file?

Or maybe is there some way to output a view directly to a file without all the template content?

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

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
11 years 3 months ago #158940

Partially solved by using the tags <pre> </pre> in the php view.

This does not generate a pure clean plain text output but renders a clean xml code on screen together with the funciton htmlspecialchars( ) that lets the characters < > not to be interpreted by the browser as tags.

example for the Low Level PHP coders like me:

echo "\t".htmlspecialchars('<internalno>'.$this->row->product_code.'</internalno>')."\n";

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

  • Posts: 84298
  • Thank you received: 13694
  • MODERATOR
11 years 3 months ago #158859

You have two solutions:
1. You htmlentities your XML code so that the tags display on the page:
php.net/manual/en/function.htmlentities.php

2. You add an exit at the end of your code, and you add headers to output the data. Like that for example:
www.php.net/manual/fr/function.header.php#86554

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

Time to create page: 0.053 seconds
Powered by Kunena Forum