|
Joined: Jan 2002
Posts: 218
Enthusiast
|
Enthusiast
Joined: Jan 2002
Posts: 218 |
Name: Underline Description: Allow your users to use underline in their posts. ( Optional) Lets the user just click on a link and it will automatically insert the tags into the body of the message. Example: Click here Link: http://www.terranbbs.com/ubb/mods/6.0/Underline.txt Note: This definitely falls under the category of something that should be included in the actual program. I've never understood why the underline code isn't included in either UBB.clasic or UBB.threads.
|
|
|
|
Joined: Jun 2002
Posts: 37
User
|
User
Joined: Jun 2002
Posts: 37 |
WrÅith,
Using your example, would it be possbile to use CENTER as another option when posting?
|
|
|
|
Joined: Jan 2002
Posts: 218
Enthusiast
|
Enthusiast
Joined: Jan 2002
Posts: 218 |
Sure. The code for that is really simple, so you could use the example above and just change the underline tags, text, etc. to center.
|
|
|
|
Joined: Jun 2002
Posts: 37
User
|
User
Joined: Jun 2002
Posts: 37 |
Here's what I have so far, any suggestions? Comments? See any mistakes? ubbt.inc.php: ============= Required - This will create the [underline, align left, center, align right, justify] tag parser insert: code: // --------------------------- // Begin Encode Underline Hack $Body =str_replace("","<u>",$Body); $Body =str_replace("","</u>",$Body); // --------------------------- // Begin Encode Align Left Hack (default) $Body =str_replace("[align left]","<p align=left>",$Body,"</p>"); $Body =str_replace("[/align left]","<p align=left>",$Body,"</p>"); // --------------------------- // Begin Encode Center Hack $Body =str_replace("[center]","<p align=center>",$Body,"</p>"); $Body =str_replace("[/center]","<p align=left>",$Body,"</p>"); // --------------------------- // Begin Encode Align Right Hack $Body =str_replace("[align right]","<p align=right>",$Body,"</p>"); $Body =str_replace("[/align right]","<p align=left>",$Body,"</p>"); // --------------------------- // Begin Encode Justify Hack $Body =str_replace("[justify]","<p align=justify>",$Body,"</p>"); $Body =str_replace("[/justify]","<p align=left>",$Body,"</p>"); before: code: // --------------------------- // Do list elements Now, so that the edit function will show UBBCode rather than HTML.. insert: code: // --------------------------- // Convert the underline tags $Body =str_replace("<u>","",$Body); $Body =str_replace("</u>","",$Body); // --------------------------- // Convert the align left tags $Body =str_replace("<p align=left>","[align left]",$Body,"</p>"); $Body =str_replace("</align left>","[/align left]",$Body,"</p>"); // --------------------------- // Convert the center tags $Body =str_replace("<p align=center>","[center]",$Body,"</p>"); $Body =str_replace("</center>","[/center]",$Body,"</p>"); // --------------------------- // Convert the align right tags $Body =str_replace("<p align=right>","[align right]",$Body,"</p>"); $Body =str_replace("</align right>","[/align right]",$Body,"</p>"); // --------------------------- // Convert the justify tags $Body =str_replace("<p align=justify>","[justify]",$Body,"</p>"); $Body =str_replace("</justify>","[/justify]",$Body,"</p>"); before: code: // --------------------------- // Conver the list markup Would it be wise to add these changes to ubbt_instant_ubbcode.tmpl and instant_markup.php? Would need more room on the UBBCode Panel to add these changes.
|
|
|
|
Joined: May 1999
Posts: 1,715
Addict
|
Addict
Joined: May 1999
Posts: 1,715 |
This looks good, I bet there are people who want these markups that don't want to install the complete MarkupHack.
There shouldn't be a problem to add them to ubbt_instant_markup.tmpl, you could make four columns of links instead of three as it is now to save some space. You would also have to add the javascript code that inserts the markup into the textarea.
|
|
|
|
Joined: Apr 2002
Posts: 1,768
Addict
|
Addict
Joined: Apr 2002
Posts: 1,768 |
1) Some of the calls to str_replace() have four arguments. I thought that function only had three arguments?
$Body =str_replace("[align left]","<p align=left>",$Body,"</p>");
2) If you want the converted HTML to be XHTML-compliant, the attribute values need to be quoted (I think). For example:
$Body =str_replace("[align left]","<p align="left">",$Body,"</p>"); $Body =str_replace("<p align="left">","[align left]",$Body,"</p>");
|
|
|
|
Joined: Jun 2002
Posts: 37
User
|
User
Joined: Jun 2002
Posts: 37 |
Dave_L, thanks for your input. Would you agree with these changes: code: // --------------------------- // Begin Encode Center, Align Left/Right/Justify Hack $Body =str_replace("[align left]","<p align="left">",$Body); $Body =str_replace("[/align left]","</p><p align="left"></p>",$Body); $Body =str_replace("[center]","<p align="center">",$Body); $Body =str_replace("[/center]","</p><p align="left"></p>",$Body); $Body =str_replace("[align right]","<p align="right">",$Body); $Body =str_replace("[/align right]","</p><p align="left"></p>",$Body); $Body =str_replace("[justify]","<p align="justify">",$Body); $Body =str_replace("[/justify]","</p><p align="left"></p>",$Body); and this: code: // --------------------------- // Convert the align left/center/right/justify tags $Body =str_replace("<p align="left">","[align left]",$Body); $Body =str_replace("</align left>","[/align left]",$Body); $Body =str_replace("</p>[align left]</p>","[/align left]",$Body); $Body =str_replace("</p><align left></p>","[/align left]",$Body); $Body =str_replace("<p align="center">","[center]",$Body); $Body =str_replace("</center>","[/center]",$Body); $Body =str_replace("<p align="right">","[align right]",$Body); $Body =str_replace("</align right>","[/align right]",$Body); $Body =str_replace("<p align="justify">","[justify]",$Body); $Body =str_replace("</justify>","[/justify]",$Body);
Last edited by jerry; 08/14/2002 2:43 PM.
|
|
|
|
Joined: Jun 2002
Posts: 37
User
|
User
Joined: Jun 2002
Posts: 37 |
Ooops, I broked it? -Fixed
Last edited by jerry; 08/14/2002 2:45 PM.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
badfrog
somewhere on the coast of Maine
Posts: 94
Joined: March 2007
|
|
Forums63
Topics37,575
Posts293,930
Members13,823
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|