Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-06-07 20:26:28

davidmg
Member
Registered: 2020-06-06
Posts: 10

have posts on external ( same domain) web page

Currently I have a script to load blog posts onto an other web page. The Title, excerpt, pubdate, author, and link attributes work fine. But what I cannot seem to find (or parse ) is the article content it self. After looking at the source of the blog post I noticed that there are two descriptions tags. One refers to the excerpt and the other to article content. I would like to eventually just create articles with-in Textpattern to keep organised and then display one particular section of articles to be displayed in that webpage.

Offline

#2 2020-06-08 04:52:27

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

Re: have posts on external ( same domain) web page

Hi davidmg and welcome to txp

If you are using a fairly recent version of txp, go to presentation>forms and create a new ‘miscellanious’ form named ext_content.

Within that form add the tags you need. Something like

<txp:article_custom section="your-particular-section">
<h1><txp:permlink><txp:title /></txp:permlink></h1>
<txp:body />
<txp:posted />, <txp:author />
</txp:article_custom>

In that non txp, php webpage add

<?php echo file_get_contents('http://your-txp-site.tld/?f=ext_content'); ?>

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 2020-06-10 01:41:31

davidmg
Member
Registered: 2020-06-06
Posts: 10

Re: have posts on external ( same domain) web page

Thx Colak;
txp version is 4.8.1

I have tried your suggestion of adding the php to the web page, however i did not work as expected

I should mention that Txp in not the main site I work on. Txp is used as a place for archival of posts. The main website contains div or elements which show 3-5 posts from the blog.

So http://your-txp-site.tld/?f=ext_content dose not work

But my blog is located http://your-txp-site.tld/blog. However I did take that into consideration but that also failed.
I have used Txp for a year but never delved into guts which I will work in the days to follow.

Offline

#4 2020-06-10 04:13:38

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

Re: have posts on external ( same domain) web page

davidmg wrote #323673:

Thx Colak;
txp version is 4.8.1

I have tried your suggestion of adding the php to the web page, however i did not work as expected

I should mention that Txp in not the main site I work on. Txp is used as a place for archival of posts. The main website contains div or elements which show 3-5 posts from the blog.

So http://your-txp-site.tld/?f=ext_content dose not work

But my blog is located http://your-txp-site.tld/blog. However I did take that into consideration but that also failed.
I have used Txp for a year but never delved into guts which I will work in the days to follow.

Can you post some urls for us to diagnose?


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

Offline

#5 2020-06-10 05:03:00

davidmg
Member
Registered: 2020-06-06
Posts: 10

Re: have posts on external ( same domain) web page

https://www.atu1724.com
www.atu1724.com/blog

the following page is just a bare minimum to see how the code will work so I can see what happens without all the html clutter before I use it elsewhere on the site.
https://www.atu1724.com/changes2.php

many thanks in advanced

Last edited by davidmg (2020-06-10 05:13:14)

Offline

#6 2020-06-10 06:02:52

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

Re: have posts on external ( same domain) web page

davidmg wrote #323676:

https://www.atu1724.com
www.atu1724.com/blog

the following page is just a bare minimum to see how the code will work so I can see what happens without all the html clutter before I use it elsewhere on the site.
https://www.atu1724.com/changes2.php

many thanks in advanced

/changes2.php appears to be a blank page from here but if you add <?php echo file_get_contents('https://www.atu1724.com/blog/?f=ext_content'); ?> within the body tags it should parse the txp content

Also can you let us know what you included in, and the name of, the form? That is the one you created under the txp backend structure >Presentation>forms?

Last edited by colak (2020-06-10 06:48:24)


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

Offline

#7 2020-06-10 10:24:21

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: have posts on external ( same domain) web page

colak wrote #323677:

Also can you let us know what you included in, and the name of, the form? That is the one you created under the txp backend structure >Presentation>forms?

Yes, check first whether https://www.atu1724.com/blog/?f=ext_content (replacing ext_content with your own form name you are using) is actually producing any output. Once you have that working, you can then look at the problem of including it in the other page.

If that works but including it with file_get_contents doesn’t, see if you can check your server logs for errors. It could be that your server or browser isn’t permitting it. (I’ve seen that when working on my local webserver with a self-signed SSL certificate, but if you’re working online with an officially issued certificate that should not be an issue).


TXP Builders – finely-crafted code, design and txp

Offline

#8 2020-06-11 00:39:15

davidmg
Member
Registered: 2020-06-06
Posts: 10

Re: have posts on external ( same domain) web page

here is my page code ‘miscellanious’

<txp:article_custom section=“updates”>
<h1><txp:permlink><txp:title /></txp:permlink></h1>
<txp:body />
<txp:posted />, <txp:author />
</txp:article_custom>

with just this code it seems to be working. when I enter —> https://www.atu1724.com/blog/updates/

I will work on putting back the default layout I have to see if it still works

however FYI https://www.atu1724.com/blog/?f=changes_log
does not produce content

Last edited by davidmg (2020-06-11 00:56:48)

Offline

#9 2020-06-11 01:01:01

davidmg
Member
Registered: 2020-06-06
Posts: 10

Re: have posts on external ( same domain) web page

here is the simple test page for the code to see if fetching posts work
https://www.atu1724.com/changes2.php
again comes up with a blank page

<!doctype html>
<html lang=“en”>
<head> <meta charset=“utf-8”> <title>The HTML5 Blank</title> <meta name=“description” content=“The HTML5 blank”> <meta name=“author” content=“davidmg” >
</head>
<body> <?php echo file_get_contents(‘http://www.atu1724.com/blog/?f=changes_log’); ?>
</body>
</html>

Last edited by davidmg (2020-06-11 01:01:49)

Offline

#10 2020-06-11 01:57:06

davidmg
Member
Registered: 2020-06-06
Posts: 10

Re: have posts on external ( same domain) web page

Out of curiosity I changed the follow and the content now gets displayed

FROM:

<?php echo file_get_contents(‘http://www.atu1724.com/blog/?f=changes_log’); ?>

TO:

<?php echo file_get_contents(‘https://www.atu1724.com/blog/updates/’); ?>

TEST Page: – working
https://www.atu1724.com/changes3.php

Last edited by davidmg (2020-06-11 02:31:59)

Offline

#11 2020-06-11 05:20:14

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

Re: have posts on external ( same domain) web page

Hi David,

Updates appears to be a page, not a form. Also did you include

<txp:article_custom section="updates">
<h1><txp:permlink><txp:title /></txp:permlink></h1>
<txp:body />
<txp:posted />, <txp:author />
</txp:article_custom>

in the changes_log form?

Lastly, if you would like me to have a look, please do let me know.


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

Offline

#12 2020-06-12 14:30:10

davidmg
Member
Registered: 2020-06-06
Posts: 10

Re: have posts on external ( same domain) web page

I did include the form as you suggested
there is a change_log ‘page’ . I may have created it before joining the forum. Would that page needed to be removed ?

Offline

Board footer

Powered by FluxBB