PDA

View Full Version : I would like to use certain elements


Trip59
7-11-03, 08:45 PM
I want to take certain things from the phpbb forum that I just set up and use them in other places on my site.

Specifically, I want to have a small section on my home page (html based site) that says if there are new posts on the forum. it would be nice to report how many, but I would like to at least have something saying there are new posts, and perhaps how many members and newest member or something.

can this even be done? If it is too complicated, just say so, I tend to get ahead of myself in learning.

Atomic-Design
7-11-03, 09:33 PM
Yeah it could be done, but not sure how easy it will be. I'd have to dedicate a large amount of time finding out how PHPbb works. I would find on the main page what lights up the new posts column, and copy that snipplet of code.

Trip59
7-11-03, 09:42 PM
Is not my intent for anyone to spend large amounts of time helping me on this, I spend several hours (at least) a day helping people aout (tutoring aside) I know how valuable time is.

perhaps, taking your lead, I can look into that and ask little questions. I'd learn more out of it that way too.


So I would look for the part of the code that determines the icon used (new/no new) and copy that. what else is needed to include that in the html page. it would be in a table cell, is there anything I have to do to signify it is php? like in javascript <script...></script>? is there a similar thing needed for php or do I just insert it? I am using DW MX for almost all my work.

I am going to go from there and if no one has an objection, will just ask the little questions to get me on track as I go. These forums are great, I have learned a bunch so far, thanks to all for their help.

Trip59
7-11-03, 11:28 PM
now, seeing as I can run php in an html document, how do I reference the /forums folder where the forums are in order to have the string make sense?

everything is in htdocs, index.htm, /forums and the folder I keep my main pages in are all at the same level. taking an educated guess, I would say that I would need to specify looking in the /forums directory for anything referenced in the other pages. how is this done, or does it even need to be?

Atomic-Design
7-11-03, 11:51 PM
Well, in order to pull this off, you're going to need to have a great understanding of how the code works. I'll lay it on the tables for you:

PhpBB stores a value in this little column (lets call it iflogin). Lets say 1 is true, and 0 is false. When the user logs in, it makes the column true. When a user accesses a category (like PHP/MySQL), it clears a value in MySQL stating that he hasn't seen it. When you posts are made that he hasn't seen, a column is represented true (and for database normalization, it is probably directly in the same row as the user himself). So, in order to find this, you'll need to analyze the database and queries to find where the checking takes place.

If you can find the code where the checking is (lets hope there's comments), then you can analyze those queries, and do the same in your custom created page. Note, you will have to connect to MySQL manually in your script, and even login so the queries fetch the right data.

Once you fetch the data you just display it. It's a simple 2 step process. The hardest part is finding out WHERE the data is being compared. Look in includes files (.inc extension). Probably the next hardest thing will be making sure you have the prerequisites to use such queries (certain PHP session include pages, data structures etc). It is pretty difficult, but this probably makes it sound harder then it really is.

Thankfully, PhpBB has some architecture in seperating data functions from actual processing functions. If you need to connect to the database, try using the same includes (db/file.php). If you want to be safe but also a little consuming, just use all the includes in index.php.

(<?php
Middle
?>)

Trip59
7-11-03, 11:58 PM
the closer I am to realizing I need to teach myself php first. I think I will probably hold off on this for now, I follow what you are saying, but it seems a little more involved than I can deal with right now, I am still trying to get the rest of the site done. I alos realised something after reading your post, the person would have to be logged in, unless I specified a time interval, that defeats part of the purpose. I think I did get a little ahead of myself here, but I really appreciate your help. gimme a few weeks to study up on PHP, then you all will be plagued with my questions:D

Any good book reccommedations for PHP?

irasmith
7-12-03, 07:15 AM
I'll jump in and add my two cents worth here on this discussion.

I don't know if you have tried this yet or not, but you may want to post your question about how to access/use certain elements over in the forums on phpbb.com site. Since that is the home site of the forum software you are using, you might find someone there who has already done what you are trying to do. Just a thought as at times I need to go back to the source site and ask questions myself that are very specific to that product.

As far as books on learning PHP4, you might give Beginning PHP4 (http://www.amazon.com/exec/obidos/tg/detail/-/0764543644/qid=1058008359/sr=8-1/ref=sr_8_1/102-4286137-2623350?v=glance&s=books&n=507846) a look over. It is the second PHP book that I purchased and I like it better than the first one I bought.

The first book I bought, PHP and MySQL Web Development (http://www.amazon.com/exec/obidos/tg/detail/-/067232525X/qid=1058008427/sr=1-1/ref=sr_1_1/102-4286137-2623350?v=glance&s=books) is also good and I learned a lot but the style of the Beginning PHP4 book flows easier for the way I go about understanding things.

Hope this helps out.

Atomic-Design
7-12-03, 09:21 AM
Befinitely go PHP and MySQL Web Development. If you want to start with pure PHP go Teach Yourself PHP in 24 Hours - the only good sams book, hehe.

Trip59
7-12-03, 10:30 AM
thank you, I will look into those books. I may try asking over there, will see, seemed more general php question and the one question I asked overthere attracted some smartass criticising me for posting. This forum seemed friendlier overall.

irasmith
7-12-03, 10:33 AM
Actually, both books I mentioned deal not only with introducing the reader to PHP by MySQL as well in terms of how to link up to MySQL with PHP and how to read/write/access data in the database. The name of the Beginning PHP4 book is just a bit misleading.

However, the publisher of the Beginning PHP4 book has another book Beginning PHP4 Databases (http://www.amazon.com/exec/obidos/tg/detail/-/1861007825/ref=cm_wl_ovu-pg.1-pos.3/102-4286137-2623350?v=glance&coliid=I32JW7DBLXX9VV&me=ATVPDKIKX0DER) which covers databases in depth from a beginner level according to the overview on the link I submitted here. I have not acquired this book yet however I may use it next as it is a prep stage for object oriented database work, which PHP5 uses to permit you to write code that would use just about any vendors database.

I'm looking at books from the view of potentially using them as training material for on line classes to offer people. Don't know if that's a dumb idea or not as I've not sought out if it would be a 'money maker' or not, but just a thought I had of one way I could use my website.

irasmith
7-12-03, 11:11 AM
Hummh, bummer to hear you got some 'wisecrack' type of remarksas I would hope that on the products home page one coudl always go for the 'final' resource when all other avenues turn up empty.

I really like the people here on powweb as they have always been freindly and helpful to me, so I just try to return the favor when I can.

Good luck with your endevors as you do have a lot on your plate.