Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2017-02-22 19:03:15

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Display lists from subsite on main site

I have a site example.com

In a folder of this site, I have a sub site installed example.com/sub

This is for simplicity. example.com is the main site to attract visitors and already has lots of articles. example.com/sub is for users to log into and create their own page. They will have limited rights and pages will also be limited to certain design criteria — it is basically only content that will change.

There will probably be example.com/sub2 as another complete txp installation too, which gets data from both other sites, processes it and returns the newly processed data to those sites.

I need to display a latest list of articles for various categories and sections of example.com/sub on example.com

Is there a way to use article_custom on sub to display articles on example.com — In other words to display lists on the txp installation that is one folder up? If it can be done with txp tags and perhaps a small bit of php, that would be perfect. But I don’t know php. Plugin territory maybe? I can pay a little.


BB6 Band My band
Gud One My blog

Offline

#2 2017-02-22 19:24:26

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

Re: Display lists from subsite on main site

You will need to install rah_external_output in the /sub /sub2 etc sites. Then you create a form with a name which starts with rah_eo_yourformnamehere. Within the form you write the code you wish. The form could contain something like:

<div>
<txp:article_custom section="yoursection" category="yourcategory" break="li" wraptag="ol">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</div>
<div>
<txp:article_custom section="yourothersection" category="yourothercategory" break="li" wraptag="ol">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</div>

In the page in your main domain you want that content to appear, you add

<txp:php>echo file_get_contents('http://example.com/sub/?rah_external_output=yourformnamehere');</txp:php>

and that’s it:)


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

Offline

#3 2017-02-22 19:31:57

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: Display lists from subsite on main site

Thanks, Yiannis, I tried that before but it didn’t work. I probably made a mistake, so will try again tomorrow. I hope it’s as simple as that!


BB6 Band My band
Gud One My blog

Offline

#4 2017-02-22 20:25:34

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: Display lists from subsite on main site

Yiannis to the rescue again! It works, I had made a mistake with my section name in the form. Thank you.


BB6 Band My band
Gud One My blog

Offline

Board footer

Powered by FluxBB