Topic: minor integration

i'd imagine this should be relatively simple, but i'm not quite sure where to start.

my site pulls some posts from my punbb db to use as newsposts on the front page.  this would be simple enough if it was only the punbb stuff i was using, but it also pulls posts from a different forum as well

as it is, i have a db for my site that has a table (we'll call it, fpp_table) which includes topic id's for punbb and the other forum.  but i have no way to automatically insert these topic ids, so I have to manually insert them into the db after i make a post.  this  is obviously a clunky way to handle things.

so what i need to do... is create a new checkbox for when i start a topic (only viewable as admin), something like "use as newspost?", and when it's checked, it runs a seperate chunk of php that inserts the relavent topic data into fpp_table

so how would i go about doing this?

2

Re: minor integration

have you looked at extern.php?

Re: minor integration

Pie!

Edit post.php, add the checkbox under the proper conditions, add an if(isset($_POST['use_news'])) type thing under the proper conditions, and put the insert statement within that smile

4 (edited by I like pie 2006-11-06 07:07)

Re: minor integration

alright, well i've just about got this down... there's just one thing.  which is a php/mysql question more than punbb...  but anyway:

how would i go about creating an insert query for a different db than what the current page is using? i see that punbb has $db->query(blah), but the $db itself seems to be calling start_transaction(), and i can't seem to find that

so what do i need to have in place of that?

Re: minor integration

Just open a new MySQL connection without using the PunBB DB layer. Something like this:

$myconn = mysql_connect('bah, you know');
mysql_select_db('DB', $myconn);
// Do some queries here
mysql_close($myconn);

Re: minor integration

well, i'd rather not have my db info inside the file itself.  i tried putting:

include('../include/np_config.php');

but then i get this:

Warning: require(../include/np_config.php) [function.require]: failed to open stream: No such file or directory in /home/.gentlegift/dev_fpp/dev.foohonpie.net/forums/post.php on line 295

but i don't see why that's wrong.  post.php is in site/forums/ and np_config.php is in site/include/

Re: minor integration

http://dev.foohonpie.net/include/
I see no np_config.php wink

Re: minor integration

haha, how dumb of me.  i put it in the actual site, not the dev

d'oh!

Re: minor integration

Well, this is working great so far, but I've come across another issue now.

I'm writing a tagging system for my newsposts.  1 for "Foohon Pie", 2 for "Trout Slap", etc...

I assume what I need now is some sort of javascript to display a list of possible tags when I check the "Newspost?" checkbox.

I've got a good idea on how to write the code, but before I do, I wanted to ask you guys if you know of another way to go about it.  I'd like to keep my stuff free of javascript if I can.

Re: minor integration

Javascript would be your best option IMO, just unhide the drop-down menu when you click the checkbox, and populate the menu through PHP.

Re: minor integration

You could just not hide the dropdown menu: hiding it or not seems to be simply a design decision.

Re: minor integration

Well, I'm thinking checkboxes instead of a dropdown.  That way I can choose multiple tags.  I think I'll have to end up hiding it so that my post page doesn't get unnecessarily cluttered.