BBCode requiring DB access

Get help developing custom BBCodes or request one.
Post Reply
User avatar
RaythXC
Registered User
Posts: 150
Joined: Wed Jun 13, 2012 1:23 pm

BBCode requiring DB access

Post by RaythXC » Sun Nov 30, 2014 10:45 pm

For one of my modules I want to create a BBCode using this format: [download]{NUMBER}[/download] which would then link to the page $phpbb_root_path/downloads.php?viewfile={NUMBER}

However, I want this to retrieve the name of said file from the database.

So essentially, it needs to take {NUMBER} then access the table phpbb_dlm_files and retrieve the value of the name column equaling the ID specified. Then it would generate the url specified above, displaying the name as the text for the URL. I realise I can do this via [download={NUMBER}]{TEXT}[/download] but i don't want users to have to put in the name themselves every time. How do I go about doing this?

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51824
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: BBCode requiring DB access

Post by Brf » Sun Nov 30, 2014 10:50 pm

You would not be able to do that with a custom bbcode. All a custom bbcode can do is have a parameterized html replacement code. There is nothing allowing SQL or PHP code to be executed.

User avatar
RaythXC
Registered User
Posts: 150
Joined: Wed Jun 13, 2012 1:23 pm

Re: BBCode requiring DB access

Post by RaythXC » Sun Nov 30, 2014 10:58 pm

Wouldn't it be possible by modifying the php files that control bbcode? Basically where the default ones are stored

User avatar
HabNurNeFrage
Registered User
Posts: 49
Joined: Sun Nov 09, 2014 10:54 pm

Re: BBCode requiring DB access

Post by HabNurNeFrage » Sun Nov 30, 2014 11:17 pm

Hi,

create an external php-file for that and call it from insight your bbcode directly , by ajax or frame it.

Cheers, HaNNF

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51824
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: BBCode requiring DB access

Post by Brf » Sun Nov 30, 2014 11:29 pm

RaythXC wrote:Wouldn't it be possible by modifying the php files that control bbcode? Basically where the default ones are stored
You would need a mod for that. You couldn't do it with a simple Custom BBcode.

Post Reply

Return to “Custom BBCode Development and Requests”