User CP
Name:  
Pass:

Register
Latest News
- RO2 multi trail...
- Sneak Peak! -D...
- Affiliate News ...
- Affiliate News ...
- Affiliate News ...
- The RIAA Defeat...
- Affiliate News ...

News Archive

Top 5 Cases
Batmobile Tumbler PC

- Batmobile Tumbler PC
     Score: 81.25
- Camo Cube
     Score: 80.00
- NemoTron
     Score: 80.00
- Wall-E
     Score: 78.33
- R2-D2
     Score: 77.00


Random Rig
Case Name: xion 2


Site Affiliates
Xoxide.com
Newegg.com
Memory Giant
ThinkGeek Electronics1and1 Web Hosting
Modders-Inc
B.C.Modding
Benchmark Reviews
KreativePC
SteelSeries
Pimpin Rigz
Lamptron


Affiliate News


  Forum Index - Web Design - The PHP thread
Author Initial Thread
BCModder
BCModderator?

Joined: Aug 8, 2006
Posts: 1488
Post Subject: The PHP thread
Posted on: Jan 11, 2008

ok I have a friend who wants me to help him setup a website and he has a template he wants to use and since I don't want to be stuck having him continually asking me either how to update the html or asking me to do it for him I was wondering if I could get some help in making a couple php lines to add into the template.

The first thing is theres a recent works section for images and I was wondering if there would be a way to add a php script into that section to scan a specific forum database table for different image file extensions and pull them to the from page when a new one is added....via image link or uploaded. *oh yea and it would have to be able to thumbnail them to so it doesn't take up a ton of room*

The second I need is a script that would be able to do basically the same as the image script only difference is instead of pulling up images I would need it to be able to basically do what fusionmods does for propagating the news and reviews to the front page from posts on the forum news section, preferably without having to mod the forum software, so like basically just by pulling the data straight from the database if possible.

My Site: http://www.bcmodding.net

My Laptop's Spec's:
Core i5 2410m 2.3Ghz
6GB DDR3 Ram
Nvidia GT 525m 1GB video card
500GB Sata HD
16x DVD-RW +/- drive
17.3 inch 900p LED Screen
- Top - Profile - Private Message - Website - Reply

faceless105
Selfmade Modder

Joined: Jun 30, 2006
Posts: 4540
Post Subject: subject
Posted on: Jan 11, 2008


The first part may be a bit tricky depending on exactly how everything is setup. Making the connection (as long as it's on your server) isn't a big deal at all, but if you're looking to parse images from the thread thats where it gets tricky because you'll need to use a regular expression to remove each image from the thread. If you set up your own image database i would reccomend storing all the images in a common directory and storing the file names along with any additional info with them in the table, that way you could grab the most recent along with the extra info. The most simplistic way of doing things would be to just upload them to a directory and grab the files that have the .jpg and gif extensions and display them, though you loose any additional information you might want to display along with them such as image descriptions, but this last method does not require a database.

Now when you say display a thumb does you want to resize the actual image thus lowering the image size? or do you jsut meen display an 800x600 image at a 100x75 size? the second is easy, to do the image resizing, you'll want to research the gd library a little. it isn't to difficult if you have a decent grasp on programming.

---------------------------------------------

For the second part thats relativly simple and you have a few options. The way I do it here is I added a button (visible to those with the user levels) to promote threads to news. ultimatly you'll want to reuse some of the forum code but i'll get to that part in a minute. The button calls a script and sends the threadId as a parameter. The script queries the database for that thread ID and copies it into a news table. Since this has been an evolutionary process and the news is a seperate functional part from the forum, if you wanted to have all your news always posted in the forum you could instead just add a table that stores a threadID and the news would grab those threads, but that would require that every news posting be posted in the forums, where as here that isn't required. The advantage is that it won't fill your database as fast.

Now the part where you'll wanna use some of the forum scripting. All forums use bbc (bulletin board code), and a variety of other string parsing functions. This is why you can type a link and have it display as a link without the link tags on here. The way you'll want to set that up to work is, once you query the news information, you'll want to run it through the string parsing thread. this will convert your thread from bbc to html and do a little error checking. Once it returns the string, you can easily just print it out to the screen.

---------------------------------------------------

Now I know that might have been a bit technical without giving any actual php but the best things to do is really plan your code before even starting to write it, otherwise you'll usually end up regreting it later on. If you have any questions on how to write it, shoot me an email and if you don't have my email (can't remember for sure, lol), just pm or im me and i'll help you on the exact coding aspect. I'm not to big on giving out copies of the site's code just because of the time invested in it, and potential security factors, but in this case it wouldn't do much good anyways. This site is sooo integrated that it would be difficult to isolate such small portions of the site. Everything in here has been coded with a very object oriented approach so a lot of the code has multiple uses. But like I said, hit me up and I can give yo a hand on the actual coding aspect of it.


If con is the opposite of pro, is Congress the opposite of progress?
- Top - Profile - Private Message - Website - Quote - Reply

BCModder
BCModderator?

Joined: Aug 8, 2006
Posts: 1488
Post Subject: subject
Posted on: Jan 11, 2008


it is all such a headache o.O might just be faster for me to modify an existing template for something like wordpress to look like the template he's using. lol but yea for the images I want them to be like the 100x17 from the original size and link to a larger image when clicked.


My Site: http://www.bcmodding.net

My Laptop's Spec's:
Core i5 2410m 2.3Ghz
6GB DDR3 Ram
Nvidia GT 525m 1GB video card
500GB Sata HD
16x DVD-RW +/- drive
17.3 inch 900p LED Screen
- Top - Profile - Private Message - Website - Quote - Reply

faceless105
Selfmade Modder

Joined: Jun 30, 2006
Posts: 4540
Post Subject: subject
Posted on: Jan 11, 2008


if your just parsing from a thread it'd be somewhat ineffecient then to do that. you'll need to parse the thread (maybe tag each thread that you've parsed already so you don't repeat the parsings), then once you find an image, rebuild it in a lower image size, then store the link to the origional as well as the thumb nail. it's run somewhat slow just because rebuilding an image is probably one of the more time consuming processes that php has to offer, atleast that i've come across so far.


If con is the opposite of pro, is Congress the opposite of progress?
- Top - Profile - Private Message - Website - Quote - Reply

sP00N
Modding Wizard

Joined: Jul 5, 2007
Posts: 776
Post Subject: subject
Posted on: Jan 12, 2008


Don't try to reinvent the wheel unless if your experienced in php. A blog or cms system like joomla will do the trick for ya.

Also work on the naming conventions of your topic, it sounds more like an info thread :P


steamid: dead7iest_weap0n
AMD X4 720 @ 3.5GHZ, 4GB DDR2, PowerColor 5770 1GB, 40" LCD, 200gb+ 2TB HDD's
Now A+, Net+, Linux+ and MCTS Windows 7 and Server '08 Certified :D
- Top - Profile - Private Message - Website - Quote - Reply

BCModder
BCModderator?

Joined: Aug 8, 2006
Posts: 1488
Post Subject:
Posted on: Jan 12, 2008


well I can hack away at php to make minor modifications but the site isn't mine it's a friends and well with what it would take to setup the necessary php code I may as well just remake a template for something like wordpress cause then all I have to do is mess around with the alignments more or less, as for the naming of the topic meh it works, its' not like the topic is limited to just my question I figure rather then a ton of threads being created to ask a repeated question any questions asked in here and answered may give insight and create less clutter in the database. *I know the tactic never seems to work but meh*


My Site: http://www.bcmodding.net

My Laptop's Spec's:
Core i5 2410m 2.3Ghz
6GB DDR3 Ram
Nvidia GT 525m 1GB video card
500GB Sata HD
16x DVD-RW +/- drive
17.3 inch 900p LED Screen
- Top - Profile - Private Message - Website - Quote - Reply







FusionMods.Net

Total Time: 3.48705