Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-01-18 19:35:02

sochicomputerRU
Member
From: Россия
Registered: 2013-01-18
Posts: 61
Website

List of latest articles outside textpattern site

Here is the deal, I have static site, and within that site there is a textpattern blog.

www.site.com (static site)
www.site.com/blog (textpattern)

For SEO I need changing content on front page, I want to display latest article titles, and maybe lasted files, etc.

Basically how to achieve it? I’m down for creating a plugin if needed, but not from scratch! Point me into the right direction. I’m thinking about creating some html in a file and then including it via SSI on the main page.

Offline

#2 2013-01-19 10:16:32

etc
Developer
Registered: 2010-11-11
Posts: 5,471
Website GitHub

Re: List of latest articles outside textpattern site

sochicomputerRU wrote:

I’m thinking about creating some html in a file and then including it via SSI on the main page.

Sounds interesting, though I have no experience with SSI. There are some txp plugins that write on the disc, but they are triggered on the public side. What you need is a plugin that will write a list of recent articles in an html file on article update. This seems feasible, along these lines:

  • install rah_external_output and write a snippet that contains only <txp:recent_articles /> tag;
  • create an admin-side plugin that will be called on article save. It will retrieve the snippet’s output (with file_get_contents?) and write it to the disc.

Offline

#3 2013-01-19 11:06:56

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,260
Website GitHub Mastodon Twitter

Re: List of latest articles outside textpattern site

I agree with Oleg that rah_external_output is the way to go. You will not need to create a plugin for the files. <txp:file_download_list limit="10" break="li" wraptag="ul" sort="id desc" /> would do I think.

to embed the output in your front page it will need to have a php extension (for example index.php) and paste the code:

<?php echo file_get_contents('http://www.yoursite.tld/?rah_external_output=your_rah_form_name');?>


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2013-01-20 06:11:18

sochicomputerRU
Member
From: Россия
Registered: 2013-01-18
Posts: 61
Website

Re: List of latest articles outside textpattern site

Yes, those are good ideas guys, it be nice to have a plugin for which you can specify a page and will write anything to anywhere outside. I even come up with a name, static_page_creator. But I’m not going to mess with it.

I’ve created what I needed using iframes. Here is what it looks like:

www.sochicomputer.ru

Basically, within textpattern there are two pages, inc_latatest_articles and inc_latest_downloads. These pages have html and textile code which outputs last articles and downloads. Then in my blog menus I exclude these sections. On my outside page I just use iframes to do what I want.

ez

But perhaps not SEO friendly.

I mean, do visiting search engines index iframes? Because the whole point behind this is not aesthetics, but the run for SEO optimization. It be nice to have php include or SSI include, so maybe some of you will make this plugin?

Last edited by sochicomputerRU (2013-01-20 06:13:40)

Offline

#5 2013-01-21 09:54:53

etc
Developer
Registered: 2010-11-11
Posts: 5,471
Website GitHub

Re: List of latest articles outside textpattern site

sochicomputerRU wrote:

I’ve created what I needed using iframes. But perhaps not SEO friendly.

Perhaps, perhaps, … If your “static” main page is php, the easiest way is the Yiannis one, though it seems more natural to redo the whole site with Textpattern.

It be nice to have php include or SSI include, so maybe some of you will make this plugin?

Perhaps, perhaps, perhaps

Offline

#6 2013-01-27 16:22:09

etc
Developer
Registered: 2010-11-11
Posts: 5,471
Website GitHub

Re: List of latest articles outside textpattern site

Here is a tiny “plugin” that will save recent articles list in some static.html file. I have no time to make an interface now, sorry, maybe later. So

  • install rah_external_output and create a form called rah_eo_recent_articles, where you put only <txp:recent_articles /> (or whatever you need);
  • install and activate this plugin:
YToxMTp7czo0OiJuYW1lIjtzOjEwOiJldGNfc3RhdGljIjtzOjY6ImF1dGhvciI7czowOiIiO3M6MTA6ImF1dGhvcl91cmkiO3M6MDoiIjtzOjc6InZlcnNpb24iO3M6MzoiMC4xIjtzOjExOiJkZXNjcmlwdGlvbiI7czowOiIiO3M6NDoiaGVscCI7YjowO3M6NDoiY29kZSI7czoyNTc6InJlZ2lzdGVyX2NhbGxiYWNrKCdldGNfc2F2ZScsICdhcnRpY2xlX3NhdmVkJyk7DQpyZWdpc3Rlcl9jYWxsYmFjaygnZXRjX3NhdmUnLCAnYXJ0aWNsZV9wb3N0ZWQnKTsNCg0KZnVuY3Rpb24gZXRjX3NhdmUoKQ0Kew0KCWlmKCRmaWxlID0gZmlsZV9nZXRfY29udGVudHMoaHUuJz9yYWhfZXh0ZXJuYWxfb3V0cHV0PXJlY2VudF9hcnRpY2xlcycpKQ0KCQlmaWxlX3B1dF9jb250ZW50cyh0eHBhdGguJy90bXAvc3RhdGljLmh0bWwnLCAkZmlsZSk7DQp9IjtzOjQ6InR5cGUiO3M6MToiNCI7czo1OiJvcmRlciI7czoxOiI1IjtzOjU6ImZsYWdzIjtzOjE6IjAiO3M6MzoibWQ1IjtzOjMyOiJjNjI4ODEzM2IyNDRmZTg2YzkyMGFjNmQzYWEwMGU5MyI7fQ==

Finally put include(your_textpattern_path.'/tmp/static.html'); wherever you need it in your “static” site, if it is PHP, or corresponding SSI instruction.

Edit: and save some article to trigger the file creation.

The code is very basic, modify it as you like, just check that the plugin type is 4:

register_callback('etc_save', 'article_saved');
register_callback('etc_save', 'article_posted');

function etc_save()
{
	if($file = file_get_contents(hu.'?rah_external_output=recent_articles'))
		file_put_contents(txpath.'/tmp/static.html', $file);
}

Last edited by etc (2013-01-27 16:28:58)

Offline

#7 2013-02-02 04:18:53

sochicomputerRU
Member
From: Россия
Registered: 2013-01-18
Posts: 61
Website

Re: List of latest articles outside textpattern site

What’s needed to make an interface for it? How to make it a complete plug-in?

Maybe we should make it together? Just point me into the right direction!

I just realized that my static off textpattern HTML sitemap could use article, file, gallery links as well. There, iframes simply would not work, needs a php include. Man, I’m feeling so foolish for not making my entire site using textpattern!

Offline

#8 2013-02-03 09:46:28

etc
Developer
Registered: 2010-11-11
Posts: 5,471
Website GitHub

Re: List of latest articles outside textpattern site

sochicomputerRU wrote:

What’s needed to make an interface for it? How to make it a complete plug-in?

It is complete (it works), it just is not very handy. A minimal interface could be an admin tab allowing to associate rah_external_output snippets (like recent_articles above) with files to save their output in (/tmp/static.html) and the events (like article_saved) that must trigger the file save. One could also add create/delete file buttons, checkboxes for batch operations, and so on.

Maybe we should make it together? Just point me into the right direction!

I have never coded an admin tab, so couldn’t be of much help right now, but would be glad to learn. May be, someone knows an admin tab “Hello, world” plugin? Here is a general primer of plugin creation to make you start.

Offline

Board footer

Powered by FluxBB