Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-27 07:43:45

volomike
Member
Registered: 2008-05-26
Posts: 16

Integrating phpBB with TXP

Here’s my project goals. Any advice you have would be welcome. I’m a PHP Freelancer who is brand new to TXP. I have it installed and have added on the hak_tinymce and the Aeron admin interface.

BACKGROUND. I have an information portal project for my client. By NDA, I can’t tell you what kind of information, so let’s make something up — information for farmers. Most of the content for the system will be stored in phpBB. In general the project will mate a phpBB system with the TXP. We plan to have a central admin flag posts in the forum and then they will automatically appear inside custom gadgets in the TXP system. Images will be assigned to those flag posts by another admin page that I’ll build for that custom gadget.

TEMPLATE. Each page will be a header, a footer, and then a two-column layout between the two with a wide left side and a sidebar on the right. The page is 960px wide, centered in the middle of the screen. I have created a sample.html XHTML template. I’ll need to understand how to insert this template into the TXP system and fill it with txp tags, especially for custom gadgets.

USE OF TXP, PART 1. The use of TXP will merely be as a hanger for custom gadgets and a way for my client on some of the sections to type up some content occasionally.

SEARCH. The Search field will be in the header on the top right of every page. It basically will search only in the phpBB forums, not TXP, but it will tack on which forum group to search in depending on context.

SECTION BAR. The header will include the section bar, letting me choose: Home | Guides | Articles | Book Blog | Forum | E-Store | FAQ | Contact. All of these will take me to a different CMS section page with the exception of Forum, which should redirect to forum/index.php, which loads the phpBB that I have themed to look like the TXP site. (BTW, Guides is a HowTo section.)

CUSTOM GADGETS. In general on each section page besides the Forum, Book Blog, E-Store, FAQ, and Contact pages, it basically will be the following. Left side contains 4 custom gadgets stacked on top each other. Right side will provide 3 custom gadgets stacked on top each other.

USE OF TXP, PART 1. On the Book Blog, E-Store, FAQ, and Contact section pages, these will pull directly from the TXP publishing system. The E-Store will basically have static information that is updated from time to time, some photos, and then will have “Add To Cart” buttons from PayPal Web Payments Standard (free).

INTEGRATION WITH phpBB. I’ll need to build the custom gadgets that pull data from the forum system such as top 10 last forum posts, top 5 last howto/guide posts that were flagged by the admin, top 5 last article posts that were flagged by the admin. Clicking the articles, guides, or forum posts will take one directly into the phpBB part of the site.

TO DO:

  • Learn how to add another field to phpBB posts so that the admin can flag items and only he can see the button to flag items.
  • Learn how to take my XHTML template and integrate it into the TXP system.
  • Learn how to specify custom gadgets in TXP.
  • Learn how to read in the phpBB posts and redisplay in custom gadgets in TXP.
  • Adding a search form that does a search against phpBB instead of the TXP system.
  • Creating a contact form on the Contact section of the TXP site.

Last edited by volomike (2008-06-27 07:44:43)

Offline

#2 2008-06-27 08:07:29

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Integrating phpBB with TXP

  1. No idea how to extend phpBB, but I imagine you could figure it out by looking at some of their modules/plugins.
  2. TextBook
  3. What the heck is a “gadget”?
  4. Use <txp:php> or a plugin with mysql_query.
  5. Search – just rip the HTML phpBB uses and drop it into your TXP template. If you want the search results to stay on the page, you could just do a simple scraping with file_get_contents
  6. Contact form – see zem_contact_reborn

Offline

#3 2008-06-27 08:43:19

volomike
Member
Registered: 2008-05-26
Posts: 16

Re: Integrating phpBB with TXP

Sorry. Gadget = some sort of screen widget in a box placed on the screen to hang your own custom stuff. I was hoping to create an article with no content inside, but simply put a gadget tag inside of that. Then, I could have that do a call back to a custom page on the server that serves up the content into that space.

Offline

#4 2008-06-27 08:55:41

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Integrating phpBB with TXP

Ah. A plugin would be the best option for that – faster development using the plugin cache. However, you can always go the <txp:php> (= <?php ?>) route:

<txp:php>
echo 'Go go gadget finder!';
</txp:php>

The downside is that your PHP could be mangled between copy/pasting. Either way, you can dump the plugin or PHP code into an article (a form or page would be much better though).

Offline

#5 2008-06-27 08:56:24

volomike
Member
Registered: 2008-05-26
Posts: 16

Re: Integrating phpBB with TXP

Hmm. This is seeming harder than I thought. I just figured out how to use the <txp:php> tag inside an article and get it to display on the screen. The only problem is that the admin interface then immediately munged that article such that it removed the <txp:php> and if I were to resave that page, it would blow away my tag and source code. (Note i’m using hak_tinymce — perhaps that’s the cause — I don’t know.)

Offline

#6 2008-06-27 09:04:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,452
Website GitHub

Re: Integrating phpBB with TXP

volomike wrote:

the admin interface then immediately munged that article such that it removed the <txp:php> and if I were to resave that page, it would blow away my tag and source code.

I’ve had this before. Normally switching the article’s “Advanced Options -> Article Markup -> Leave text untouched” fixes it for me. But then that means you can’t use textile in the article which is sometimes more bother than not.

The best method is probably as jm suggested: put a <txp:output_form form="my_php" /> in your article and then defer the code to that TXP form where it won’t be mangled.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2008-06-27 09:07:11

volomike
Member
Registered: 2008-05-26
Posts: 16

Re: Integrating phpBB with TXP

What if I did it like this, instead?

When the end user goes to index.php on the site, instead of going straight into TXP, it loads my custom gadgets and the page cannot be edited except by a programmer. But when they click on things like Book Blog, E-Store, Contact, and FAQ pages, it could pull the content somehow out of the TXP database and redisplay it on the screen. So, I don’t necessarily run things through TXP except for the admin system to get the content into the database, and then I pull it back out and display it on the screen via a database call and an echo. Would that work?

Offline

#8 2008-06-27 09:35:25

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Integrating phpBB with TXP

It seems like a hassle to do it that way, and it defeats the purpose of TXP’s templating. Integrating your own PHP isn’t hard, but you’re better off not mixing it with articles. Check out the conditional tags like if_section, if_category, and if_article_id.

<txp:hide>If the section is 'foo', run your PHP</txp:hide>
<txp:if_section name="foo">
    <txp:php>echo 'bar';</txp:php>
</txp:if_section>

Offline

#9 2008-06-27 12:03:42

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: Integrating phpBB with TXP

volomike wrote:

I was hoping to create an article with no content inside, but simply put a gadget tag inside of that. Then, I could have that do a call back to a custom page on the server that serves up the content into that space.

What sort of content are you talking about here? Get more specific, please. Maybe it’s unnecessary to reinvent the wheel.

Last edited by uli (2008-06-27 12:08:20)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#10 2008-06-27 18:42:01

atbradley
Plugin Author
From: Rhode Island, US
Registered: 2007-02-15
Posts: 34
Website

Re: Integrating phpBB with TXP

TEMPLATE. Each page will be a header, a footer, and then a two-column layout between the two with a wide left side and a sidebar on the right. The page is 960px wide, centered in the middle of the screen. I have created a sample.html XHTML template. I’ll need to understand how to insert this template into the TXP system and fill it with txp tags, especially for custom gadgets.

If you need Textpattern beginner tutorials, I’d recommend starting here. Converting an HTML template into Textpattern pages/forms is usually pretty straightforward.

SECTION BAR. The header will include the section bar, letting me choose: Home | Guides | Articles | Book Blog | Forum | E-Store | FAQ | Contact. All of these will take me to a different CMS section page with the exception of Forum, which should redirect to forum/index.php, which loads the phpBB that I have themed to look like the TXP site. (BTW, Guides is a HowTo section.)

This shouldn’t be a problem. Just set up all these sections (including forum) in Textpattern. If there’s an actual forum directory, Apache will use that instead of asking Textpattern for /forum, if you’re using Textpattern’s default .htaccess file. <txp:section_list> will give you a section bar.

CUSTOM GADGETS. In general on each section page besides the Forum, Book Blog, E-Store, FAQ, and Contact pages, it basically will be the following. Left side contains 4 custom gadgets stacked on top each other. Right side will provide 3 custom gadgets stacked on top each other.

I agree with jm: You probably don’t want to put these inside articles. Either write a plugin which provides a tag to generate each gadget, or write them in forms between <txp:php></txp:php> tags, with each gadget in its own form.

INTEGRATION WITH phpBB. I’ll need to build the custom gadgets that pull data from the forum system such as top 10 last forum posts, top 5 last howto/guide posts that were flagged by the admin, top 5 last article posts that were flagged by the admin. Clicking the articles, guides, or forum posts will take one directly into the phpBB part of the site.

Do you have to use phpBB? Simple Machines Forum provides some useful external integration functions in its SSI.php file. I’ve only set up SMF once, but I’m reasonably happy with it, although I can’t get the Akismet mod working. The external integration also includes a search form, which takes care of one of your other problems.

Failing that, I think smf_query could also do much of this work for you, if Textpattern and your forum software share a database. mem_form would probably be a good starting point for a phpBB search plugin.

Creating a contact form on the Contact section of the TXP site.

zem_contact_reborn.

Offline

#11 2008-06-27 18:53:59

volomike
Member
Registered: 2008-05-26
Posts: 16

Re: Integrating phpBB with TXP

What sort of content are you talking about here? Get more specific, please. Maybe it’s unnecessary to reinvent the wheel.

I need “gadgets” (screen widgets, screen sections, plugins, whatever you want to call them) that pull via require_once() or Curl/Wget from a background PHP page that’s hosted on the server in a subdirectory.

On the homepage, it will read from the phpBB forum database to show the last 4 flagged articles by the admin of the phpBB forum. That way, he can post stuff into the forum and it gets published with an excerpt on the homepage. However, the way he wants me to do it is that there are “Guides” and “Articles”. Guides will pull from the forum group called “How To”. Articles, which display beneath Guides, will pull from any other forum group. He also wants to be able to associate a small image (120×120 pixels) with the flagged article, a hyperlink surrounding the forum post’s thread subject to take one directly into the article, a Created By, and a Created Date. So, he wants a gadget that handles “Articles” and another that handles “Guides”, and these are shown in the main area of the page to the left of the sidebar.

  • Beneath Articles and Guides gadget, a gadget that shows in a table the last 10 forum posts with hyperlinks to jump right into those.
  • In the right sidebar, he wants a small login form to login to the phpBB forum system straight from the homepage.
  • In the right sidebar, he wants a gadget for a small poll with a View Results hyperlink and a way to look at older polls.
  • In the right sidebar, he wants a gadget where he can paste in HTML blocks from ad sponsors like Google AdSense, etc.

And that’s the homepage. But there are other sections. For the Articles and Guides sections, it’s got one big gadget on the left and then an admin-editable ad block on the right. The big gadget on the left will read out of the phpBB database and display an archive of flagged articles out of the phpBB forum system.

For Book Blog and FAQ sections, these will look more like true TextPattern sections, pulling articles from the CMS.

For Forum section, this is going to get intercepted and redirected immediately to http://site/forum/ which takes one directly into phpBB’s homepage.

For E-Store, this will have one big gadget on the left and then an admin-editable ad block on the right. The big gadget on the left will allow me to build a little store for him of items that have Add To Cart buttons from PayPal on them. I’ll either go that route or hook it through Amazon with Amazon Affiliate Widgets.

For Contact section, this will display one big gadget that’s a form for permitting one to contact my client.

///

Note that I like the idea of putting the gadget tags directly into the articles if I can. And why? Well, it allows me to re-arrange the page further down the road by simply telling him to create a new article, paste a tag into it, and automatically it displays where I need it. Otherwise, I have to crack open the XHTML template and paste the tag in there.

Offline

Board footer

Powered by FluxBB