BBCode tag for inserting a part image
2012-03-20, 19:44 (This post was last modified: 2012-03-24, 11:48 by Orion Pobursky.)
2012-03-20, 19:44 (This post was last modified: 2012-03-24, 11:48 by Orion Pobursky.)
I've been working on a simple extension to learn the ropes of module creation for the Forums. I choose something simple that I thought would be useful, a BBCode tag to insert a part image based on the number.
Example:
[datimage 3001.dat]
Here's my hang up: how to handle official/unofficial parts. I've changed my mind several times on this so I thought I'd open it up for discussion instead of imposing my will on everyone else. What I have now is this:
[datimage unofficial 3001.dat]
If unofficial is left out the code assumes you want the official image.
Also, I'd like to have the default output be nothing if the part referenced doesn't exist. I'm not quite sure how to test for a broken link with PHP so if anyone can help me out, that would be awesome.
Example:
[datimage 3001.dat]
Here's my hang up: how to handle official/unofficial parts. I've changed my mind several times on this so I thought I'd open it up for discussion instead of imposing my will on everyone else. What I have now is this:
[datimage unofficial 3001.dat]
If unofficial is left out the code assumes you want the official image.
Also, I'd like to have the default output be nothing if the part referenced doesn't exist. I'm not quite sure how to test for a broken link with PHP so if anyone can help me out, that would be awesome.