Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Running external PHP file based on current article id and category
Hi to you all,
I am thinking about TxP calling an external php application with it’s own small database. But how do I do that?
Some questions:
+ Can I nest the php in a “presentation file”?
+ How do I “bring” the current TxP article ID and category to the external php app?
+ How do I give information back from the external app so that TxP takes it up and presents it in the page layout? Via “echo …..”?
I am a beginner in php by the way, but very eager to learn.
All help appreciated! Many thanks in advance.
Best regards,
Marcel
Offline
Re: Running external PHP file based on current article id and category
My methods are simple and sometimes simplistic but…
How do I “bring” the current TxP article ID and category…
You could use txp’s rss feeds and a parser to provide links to the articles in the txp db.
How do I give information back from the external app so that TxP takes it up and presents it in the page layout?
rss again?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Running external PHP file based on current article id and category
Hi Colak,
Thanks for your reply. However I think it is a bit simplistic. Let me provide some more details:
In page template:
<txp:php> ……some external application is called using {current article id and categorie(s) as parameter} ….. </txp:php>
+ the external application retrieves some information from an external database based on article ID and categories
+ the extracted information from the database is then placed back in the template as part of the HTML and presented to the user in the browser
I have a feeling this is a bit hard with RSS since it could be refering to older articles as well, but I might be wrong.
Please have another look.
Thanks.
Best regards,
Marcel
Offline
Re: Running external PHP file based on current article id and category
I have a feeling this is a bit hard with RSS since it could be refering to older articles as well, but I might be wrong.
not if the rss limit is “1”. Yet again that would limit the txp site’s possibilities. Not sure, but I think that there are feed parsers out there which can be set to show as many feeds as the user chooses, especially if that number is below the available feeds of the site.
I’m using the rss parsers on most of my sites (below). Admittedly I am only interested in linked titles but I’m sure that bring in the excerpt shouldn’t be a big problem. I seem to remember a plugin here which can be used to parse the body in the feeds.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Running external PHP file based on current article id and category
Hi Colak,
But isn’t there any possibility to get from TxP the article ID in some kind of variable to re-use in external php, while it is bringing the template to the browser?
It looks as some kind of API on TxP though….
Marcel
Offline
Re: Running external PHP file based on current article id and category
But isn’t there any possibility to get from TxP the article ID in some kind of variable to re-use in external php
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Running external PHP file based on current article id and category
That links to precisely the other way around if you ask me… So I still have hope…..
I want to wrap my external application in TxP.
Last edited by zeeforel (2007-10-22 16:25:14)
Offline
Re: Running external PHP file based on current article id and category
I’d suggest to code at least a small Textpattern plugin which collects all necessary information, calls your external app and echoes its output back to the Textpattern page parser. As you are new to PHP, this would require external help, I suppose.
Offline
Re: Running external PHP file based on current article id and category
Hi Wet,
Thanks for pointing that out.
I did manage to find this, which at least points to how to get the article id etc. I will try to experiment with this a bit.
Best regards,
Marcel
Offline
Re: Running external PHP file based on current article id and category
Further recommendation: All you ever wanted to know about Textpattern plugins — But were afraid to ask
Offline