PDA

View Full Version : Getting some BBCode to properly work


AzzazelCyC
04-25-2013, 07:18 PM
Hello again everyone,

This -I know for a fact- is a quite simple question, yet I'm not sure why I haven't been able to get it to properly work. It is about some BBCodes I am trying to implement but haven't been able to do so successfully.

The first one would be for tables; currently it is way too complex to create a table, I've tried to simplify it, yet it didn't properly work; what I want is for this to be as easy as just put up [table] [ /table] and separate data by using the "|" symbol, with the variable of a head, by using [table=head] [/ table]; would anyone be able to let me know the exact code I'd need to paste in order to get this to properly work? I've done the common HTML code for it but when I create a table, instead of add the data the user types, it puts what I posted in the "Example"....

Second one would be a "pack" of codes, which are to make images be posted to the right or left of text, but the common align (HTML) didn't work for me....and I want to use it as [IMGLEFT/RIGHT] [/ IMG].

Any help with these codes would be highly appreciated!

Lynne
04-25-2013, 07:55 PM
There are already [TABLE] and [TR] and [TD] tags in vB4. If you add another, you will mess things up.

AzzazelCyC
04-25-2013, 08:16 PM
That is exactly what I don't want the need to; on other vb boards I can create a table by simply using

[table ] data1 | data2
data1.1 | data 2.2 [ /table]

or

[table=head ] title1 | title2
data1 | data2 [ / table]

without the use of [TR/TD] as this makes it more complicated

tbworld
04-25-2013, 08:36 PM
Are you talking about creating a shorthand notation using a BBCODE in creating a new table? Sorry, I am having a hard time understanding your question, but I am trying to :)

AzzazelCyC
04-25-2013, 09:07 PM
That would be the idea, eliminate the way in which you currently have to use [TR][TD] so that users won't need to, and they can create a table simply by adding the symbol "|" to separate data; as well as the use of the [table=head] which would make the first line of the table be marked as a "header" for the table

tbworld
04-25-2013, 09:40 PM
Post what you have and see the private message I sent you.

AzzazelCyC
04-25-2013, 11:17 PM
Well, currently, what I've done is go to the AdminCP under Custom BB Codes, and add a new one, which shows as follows:

Name: Table
BB Code: row 1, cell 1 | row 1, cell 2
HTML:

<table border="1"> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table>

Replacement: basically the output of that HTML code

When a user enters something, anything into [table] tags, the output is always the same output of this specific HTML...that's my issue on this case.

Not to mention the [IMGLEFT/RIGHT] which I need to use in order to enter images that will be placed to the right or left of text, as this is highly beneficial on different news and reviews.

tbworld
04-26-2013, 12:16 AM
Okay I am guessing you are not seeing any output?

Make sure you have set remove tag if empty = no, or put something between the tags.

anything here

When you are testing. Use the testing box. You will not see any output in the example box -- until you refresh the page.


One more thing:
You are using tag "TABLE" even though this is working you are better calling it something like "QTABLE" for "quicktable". So it doesn't interfer with some weird mod that parses the BBCODE's.

AzzazelCyC
04-26-2013, 12:24 AM
The output is there, the thing is that, whatever data gets inserted in the table isn't shown, instead it shows "row 1, cell 1", "row 1, cell 2" and so on

tbworld
04-26-2013, 12:34 AM
Okay now lets make sure we are on the same page...
Where are you inserting any data? You must pass the data via {param} and {option}. Am I missing something?

For Example:
{param}

So in your case you need to pass a 'string' to your bbcode and 'carefully' parse / validate that string using PHP or JavaScript on the back end.

I will pass you some back-end code when your ready. :)

--------------- Added 1366942645 at 1366942645 ---------------

If your not familiar with what I am talking about. This is a nice little MOD that I have referred many people to by Cellarius. It is easy enough to write your own backend for bbcodes, but this is pretty useful for a structured setup.

https://vborg.vbsupport.ru/showthread.php?t=264896

AzzazelCyC
04-26-2013, 02:03 AM
Basically, if you check over the HTML code, it is inserting the "row 1, cell 1" "row 1, cell 2" as data; what I am trying to accomplish here is that, using this statement:

[table (=head if needs title)] Data 1 | Data 2 [press enter to go to the next line or terminate this row]
Data 1.1 | Data 2.1 [press enter again]
Data 1.2 | Data 2.2[/ table]

Gets to print this:

https://vborg.vbsupport.ru/external/2013/04/7.png

With the data the user has entered, obviously; therefore, I don't see a need to use php whatsoever if this is some simple HTML code that should work, as, basically, the HTML code for the table above is:

<table border="1">
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
<tr>
<td>Data 1.1</td>
<td>Data 2.1</td>
</tr>
<tr>
<td>Data 1.2</td>
<td>Data 2.2</td>
</tr>
</table>

tbworld
04-26-2013, 03:41 AM
I am not sure where our communication problem is. I do not understand how you can use your construct under vBulletins BBCODE system without some custom coding.

vBulletin default bbcode only accepts two parameters {param} and {option}. It is a simple two input system that is parsed.

I have not spent two much time pouring over the vbulletins BBCODE system, I do not use it all that much: since it is limited for safety. So if I am incorrect, please correct me, and refer me to an example using the method you are talking about.

In order to pass complex data I have always written back-end code and used the vB_bbcode_parser class. (may have spelled the class incorrectly).

----

Maybe what you are referring to is creating an HTML form. I see from this example you are using simple user prompts?

AzzazelCyC
04-26-2013, 04:58 AM
Well, I guess this was more complicated than I thought.

I got a question though, taking what you said "bbcode accepts two parameters" how does the "common" or bult-in table tags work? it needs, obviously, to be built like on HTML by using table, tr and td, but this isn't taking just 2 parameters; I see like going up to php code and everything is a bit excessive just to be able to create simple table tags, I might be mistaken though, in which case, I don't see how it is worth putting so much work into this.

tbworld
04-26-2013, 06:03 AM
Well, I guess this was more complicated than I thought.

I got a question though, taking what you said "bbcode accepts two parameters" how does the "common" or bult-in table tags work? it needs, obviously, to be built like on HTML by using table, tr and td, but this isn't taking just 2 parameters;

You're right the [TABLE] tag is not a standard BBCODE. A couple of files to look at.

/includes/class_bbcode.php
/packages/vbform/bbcodehelper/table.php.

'class_bbcpde.php'class vB_BbCodeParser
method 'parseTableTag'
method 'build_parse_array'

function 'fetch_tag_list'


Then look at 'table.php' ...

It will help you gain a little insight. :)

--------------- Added 1366961088 at 1366961088 ---------------

It occurred to me last night that you might not know that if you double click on an image in the editor you can align it left or right, change the image size and target. It is not a complete fix for image alignment in posts, but it does help.

We have altered vbulletin so that it is adaptive especially for tablets. So I did some modifications how photos are shown in the posts, depending on the number of photos. Thus extending vbulletins image positioning. Essentially creating a auto-formatted output.