Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-03-24 05:34:23
- WebCentric
- New Member
- Registered: 2010-03-24
- Posts: 5
Pulling content out of TXP to a static Page
Hi,
I would like to know if anyone could help me with the following:
I would like to pull the 3 latest posts to a static php home page that exists outside of a standalone textpattern blog.
MORE SPECIFICALLY:
I have built a few add on textpattern blogs for some existing html sites for a client. The txp blog exists in the root like this:
ROOT
index.php
about.php
TXP-FOLDER (titled-“blog”)/index.php
So since the whole site isn’t run through textpattern I don’t know how to pull some recent posts to the home page.
Any help with this would be greatly appreciated.
Last edited by WebCentric (2010-03-24 06:00:09)
Offline
Offline
#3 2010-03-24 06:02:48
- WebCentric
- New Member
- Registered: 2010-03-24
- Posts: 5
Re: Pulling content out of TXP to a static Page
Hi Whaleen,
Thank you for the help, I’ll checkout simplepie right now.
Cheers,
Offline
#4 2010-03-24 06:34:50
- WebCentric
- New Member
- Registered: 2010-03-24
- Posts: 5
Re: Pulling content out of TXP to a static Page
Works great!
Offline
Re: Pulling content out of TXP to a static Page
Simplepie is great but I found that I also needed a cron job to delete the cache 3-4 times a day which meant that the update on the static page was not immediate.
rah external output solves this.
In your static page: <?php include($DOCUMENT_ROOT . "http://my-txp-site.tld/?rah_external_output=template1"); ?>
where template1 contains <txp:recent_articles label="" break="li" wraptag="ul" limit="3" />
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#6 2010-03-25 01:29:51
- WebCentric
- New Member
- Registered: 2010-03-24
- Posts: 5
Re: Pulling content out of TXP to a static Page
@colak
Thanks for the help. While playing with simplepie locally I found that the cache didn’t update quickly.
I found a snippet to disable cache which allows for what appears to allow real time page loads. Is this a bad idea?
Does the rah plugin do something different?
Thanks
Offline
Re: Pulling content out of TXP to a static Page
The rah plugin does not rely on feeds (rss or atom). The idea is that you can have almost any content ‘parsed’ from your txp install into another page/site.
RSS and Atom feeds are the standards but you might also want to have the same menu across the whole site. That’s where the rah plugin excels.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#8 2010-03-25 21:25:35
- WebCentric
- New Member
- Registered: 2010-03-24
- Posts: 5
Re: Pulling content out of TXP to a static Page
Oh, I see, that does sound like a better solution.
More versatile and I would not need to rely on an additional software package. Thanks again for the help!
Offline
Re: Pulling content out of TXP to a static Page
Yep, rah_external_output is definitely what you need, just create a new external form pretty much like you would for forms within the CMS, and then use the following in your static php page…
<?php echo file_get_contents('http://yoursite.com/?rah_external_output=name_of_external_form'); ?>
Change ‘name_of_external_form’ to whatever you call the external output, and you are good to go. Works across domains too.
Offline