Log in

View Full Version : BB code generator?



Jinglebelle
03-27-2008, 09:01 PM
I'm really needing some sort of script that will generate BB code when some one fills in the form with the image name. Does that make sense to any of you? It would only need one text entry field and only need to generate one line of code around the submitted text.

I appreciate any help :)

Monica

djr33
03-27-2008, 09:35 PM
So you can it to write the BB code, not parse it?

That's pretty easy.

However, you'll need to give a bit more information:

What, exactly, does this BB code do? Is it just an image tag?

Secondly, and more importantly, what BB code should it generate?

Using PHP (or another similar language-- even, though not preferably, Javascript) you can generate a line of text with variables without much trouble at all. It's just a matter of fill in the blanks.

As an example,
<?php echo '[img='.$_POST['img'].']'; ?>

Jinglebelle
03-28-2008, 12:34 AM
Yes, just a basic image tag...
[ IMG ]http://www.mywebsite.com/theimage.jpg [ /IMG ]

Basically I am wanting my users to be able to copy and paste an image name into a form input field, click submit, then be able to copy the generated code.

I am allowing my users to hot link images for forum posts (phpbb, IPB, vBulletin) and I thought a code generator on the page would save me time and space... That way I wouldn't have to write each code and place it below each image.


Thank you ;)

Jinglebelle
03-28-2008, 06:29 PM
I really need help guys. I have no clue how to create this myself. :(

Um, I found a table generator that is sorta comparable to what I am needing. http://www.2createawebsite.com/build/table_generator.html

OK, users fill in info, click generate, and voila... code. I need something with one text entry field, to generate the appropriate code around the text entered. Which in this case would be a file name. It would generate the same code each time, just with the users file name.

djr33
03-28-2008, 06:52 PM
I gave you the information already, in general terms.
<?php echo ''.$_POST['img'].''; ?> will fit what you need.
Now, just submit a form using method="post", and a field with the image's url as name="img".
OR you can replace $_POST['img'] with another variable like $img, if you can get the data another way.
But I don't know what you're using to get the img's url, so I'm not sure how to output it.

Jinglebelle
03-28-2008, 06:56 PM
:o You must think I am smarter than I am... heh, heh... ;)

I do appreciate your help, Thanks :)