- Posts: 640
- Thank you received: 16
Output view as plain text or XML file
- PeterChain
-
Topic Author
- Offline
Less
More
12 years 3 months ago #158840
by PeterChain
Output view as plain text or XML file was created by PeterChain
-- 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?
-- 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.
- PeterChain
-
Topic Author
- Offline
Less
More
- Posts: 640
- Thank you received: 16
12 years 3 months ago #158940
by PeterChain
Replied by PeterChain on topic Output view as plain text or XML file
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";
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.
12 years 3 months ago #158859
by nicolas
Replied by nicolas on topic Output view as plain text or XML file
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
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.164 seconds