Output News template to a file? Topic is solved

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
reinhardmohr
Forum Members
Forum Members
Posts: 112
Joined: Sun Aug 06, 2006 2:36 pm
Location: Munich, Germany

Output News template to a file?

Post by reinhardmohr »

Hi,
could anybody help me / give me a hint with the News module?
I am neither a Smarty specialist nor a programmer – so I have been looking around for a long time.
Problem / question:

I need to output a news template to write a file to the file system on the server.
I can fetch a file with smarty, no problem. But I could nowhere find how to write a file with smarty. The idea is to use a news template to output the latest 10 news – and then write the output to a file in a directory on the server so that it can be read and / or downloaded by another application or website.

I am using CMSms 2.2.16 and the latest module updates.
Thanks for helping!

Reinhard
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Output News template to a file?

Post by DIGI3 »

This tutorial is for creating an rss feed from cgblog, but I think a similar process would work for what you're trying to achieve. It doesn't create a physical file on the server, but a page that acts as a file - so it would be accessible by url but not a local file path. You'll need to adapt the tutorial to your needs: https://cmscanbesimple.org/blog/create- ... t-a-module
Not getting the answer you need? CMSMS support options
reinhardmohr
Forum Members
Forum Members
Posts: 112
Joined: Sun Aug 06, 2006 2:36 pm
Location: Munich, Germany

Re: Output News template to a file?

Post by reinhardmohr »

Hi, Digi3,

thanks for the quick and helpful response!
I knew this blog of Rolf‘s – but I had no idea that it would solve my problem! Thank you!

A bit more information: I needed to output 10 news of the news module as a json file that could be read for further processing in an app. While I could do the formatting of the news I could not output it with the ending .json.
Rolf‘s blog now gave me the important clue: Under the "Navigation" tab there is a field where I can just type in a url to my desire. So I typed in "page.json". And now the output of the news module can be read as nothing but a json-file (actually a json-formatted page). This works – great!

Thanks again for helping
and for making CMSms and all the great modules!
Reinhard
Post Reply

Return to “CMSMS Core”