Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-06-10 14:16:26
- PzSniper
- New Member
- From: Italy
- Registered: 2009-06-10
- Posts: 9
Textpattern articles in an XHTML page? How do i embed it?
I’m building an xhtml site that is a hybrid of my own mootools, images, markup and Textpattern for the front page news.
I want to selectively include different chunks of content within existing HTML pages.
How can i do?
Php include… which file?
I know this FAQ http://textpattern.com/faq/65/how-do-i-embed-textpattern-in-an-external-page but i can’t embed content or script in Textpattern.. way too much complicated.
Please advice…
Offline
Re: Textpattern articles in an XHTML page? How do i embed it?
As long as you don’t have other PHP stuff that will interfere with TXP
Then in the .php page you want to use TXP tags place this before anything:
<?php define("txpinterface", "public");
include '/absolute/path/to/root/textpattern/config.php';
include $txpcfg['txpath'].'/publish.php';
ob_start();?>
Then after </html> add this:
<?php $output = ob_get_clean();
echo parse($output);?>
Now you can use TXP tags on that page.
I haven’t used this method in a long time – but it used to work quite well.
Offline
#3 2009-06-10 15:58:45
- PzSniper
- New Member
- From: Italy
- Registered: 2009-06-10
- Posts: 9
Re: Textpattern articles in an XHTML page? How do i embed it?
Thank you renobird for quick answer… but please help me a little more.
Put those codes inside html page and now it doesn show up at all…
Sadly i don’t know how to paste HTML souce on the fourm here…
actually i’m using a simple: <?php include(“textpattern/index.php”); ?
and works well but when i try to go to the articles archives it’s a mess…I need urgent help if possible can you met on on Live Messenger?
Last edited by PzSniper (2009-06-10 15:59:50)
Offline
#4 2009-06-10 21:06:11
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Textpattern articles in an XHTML page? How do i embed it?
PzSniper wrote:
Sadly i don’t know how to paste HTML souce on the fourm here…
Offline
#5 2009-06-11 14:59:52
- PzSniper
- New Member
- From: Italy
- Registered: 2009-06-10
- Posts: 9
Re: Textpattern articles in an XHTML page? How do i embed it?
Thank Els, but it doesn’t matter now that html, i’m just going to make a new one, just pelase..someone can answer and help me embedding textpattern main page inside another xhtml or php page?
Is there any other posts explain implementation steps? Textpatter is so flexbile… shouldn’t be impossible to do…
Offline
Re: Textpattern articles in an XHTML page? How do i embed it?
PzSniper,
You’re trying to use TXP tags in a non-Textpattern page correct? If so, use the method I described above.
I don’t know of a method for “embedding textpattern main page inside another xhtml or php page” – basically you need to do what I described above and then use the TXP tags you have in your default TXP page in your custom PHP page (note the page has to be PHP for any of this to work).
Good luck.
Offline
Re: Textpattern articles in an XHTML page? How do i embed it?
You could of course use ajax to grab the content of the textpattern page and pull it into your xhtml page.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#8 2009-06-11 16:39:42
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Textpattern articles in an XHTML page? How do i embed it?
Why not do it the other way around? Use Txp for your entire site, and just add your static content to it.
Offline
#9 2009-06-12 08:14:10
- PzSniper
- New Member
- From: Italy
- Registered: 2009-06-10
- Posts: 9
Re: Textpattern articles in an XHTML page? How do i embed it?
Els wrote:
Why not do it the other way around? Use Txp for your entire site, and just add your static content to it.
Sorry els but this is not possible, bacuse site it’s nearly finished and include a lot of libs, js, ajax and so on… only need to embed TXP, can someone explain how embed it tha Ajax?
Offline
#10 2009-06-12 08:18:18
- PzSniper
- New Member
- From: Italy
- Registered: 2009-06-10
- Posts: 9
Re: Textpattern articles in an XHTML page? How do i embed it?
renobird wrote:
PzSniper,
You’re trying to use TXP tags in a non-Textpattern page correct? If so, use the method I described above.
I don’t know of a method for “embedding textpattern main page inside another xhtml or php page” – basically you need to do what I described above and then use the TXP tags you have in your default TXP page in your custom PHP page (note the page has to be PHP for any of this to work).
Good luck.
Hi reno, i’ve already tried to embed those tags above, but maybe i pasted them wrong and page doesn’t load at all… can you provide me a simple, php page with those tags at beginning and bottom footer + main page content txp tags in the middle) I’ll use it like an example.
What about grab “txp archive” without login style of xhtml main page?
Last edited by PzSniper (2009-06-12 08:19:50)
Offline
#11 2009-06-12 08:40:08
- PzSniper
- New Member
- From: Italy
- Registered: 2009-06-10
- Posts: 9
Re: Textpattern articles in an XHTML page? How do i embed it?
<?php define("txpinterface", "public");
include '/textpattern/textpattern/config.php';
include $txpcfg['txpath'].'/publish.php';
ob_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento senza titolo</title>
</head>
TESTING TESTING
<table width="100%" border="0">
<tr>
<td>ABC</td>
</tr>
</table>
<body>
</body>
</html>
<?php $output = ob_get_clean();
echo parse($output);?>
This doesn’t work… :( index.php is in the root and TXP installed inside /texpattern
Last edited by els (2009-06-12 16:01:55)
Offline
Re: Textpattern articles in an XHTML page? How do i embed it?
I just set up a test page using renobird’s example and it worked.
Your include path is '/textpattern/textpattern/config.php'
. This needs to be an absolute path (a file path, not a URL).
Code is topiary
Offline