PDA

View Full Version : customize bbcode attach


ddrake
01-22-2010, 05:33 PM
Does anyone know how to create a custom bbcode that works just like the built-in [attach] but that has a {param} for the link text?
For example, {attach}56{/attach} appears to generate in my case the following html:
<a href="attachment.php?attachmentid=56?&d=1264185515>The File Name</a>
I think I would like my custom bbcode to work possibly something like this:
My link text
to generate this:
<a href="attachment.php?attachmentid=56?&d=1264185515>My link text</a>

--------------- Added 1264220800 at 1264220800 ---------------

Maybe it's not possible... I'm not sure what the 'd=1264185515' argument does, but it's probably different for each attachment, so we'd need a way to pass two arguments to the custom bbcode. But I gather that bbcodes can only handle one.

--------------- Added 1264266546 at 1264266546 ---------------

Well, I'm still not sure what the [purpose of the 'd=1264185515' argument is, but it doesn't seem to be a critical part of the url.

This custom bbcode seems to work: :)
<a href="attachment.php?attachmentid={option}">{param}</a>
The usage is the same as I showed above:
My link text
To find out what attachmentid to use, simply use attachment manager to insert inline to create an 'attach' bbcode, then edit it.

ddrake
01-23-2010, 03:37 PM
There is one side effect of using this custom bbcode. Since the application doesn't see a regular 'attach' code for the item, it shows an 'Attached Files' box when viewing the full article in CMS. However, If you have 'Display Full Article in Section Page' = Yes and are viewing the page at the section level, you don't see the 'Attached Files' box. In the example below, the first attachment is using the standard 'attach' bbcode, while the second uses the custom one. For my purposes, this shouldn't be a problem.

110858

110859