Customizing SMF > Tips and Tricks

See PDF in Posts

(1/25) > >>

FaSan:
Little Tips ;)



--- Code: ---<search>
// Match a table... hopefully with everything in the right place.
'~\[table\](?:\s|\xA0|<br />|&nbsp;)*((?:\[tr\](?:\s|\xA0|<br />|&nbsp;)*\[td\]).*?(?:(?:\s|\xA0|<br />|&nbsp;)*\[/td\]\[/tr\])*)(?:\s|\xA0|<br />|&nbsp;)*\[/table\](?:\s|\xA0|<br />|&nbsp;)?~i' => '<table>$1</table>',
</search>


<add after>
// PDF [pdf]example.pdf[/pdf]
'~\[pdf\](?:<br />)*([^<>]+?)(?:<br />)*\[/pdf\]~i' => isset($disabled['pdf']) ? 'PDF: $1' : '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="500" height="400"><param name="src" value="$1"><a href="$1" target="_blank">$1</a></object>',
</add after>

--- End code ---


Use with tag [pdf]example.pdf[/pdf]


It's work if you have in your browser the appropriate plugin (adobe acrobat o similar)


FaSan

xenovanis:
Thank you, very usefull!

I 'read' the Italian post, it's supposed to be added in Subs.php?

FaSan:
Yes  ! Excuse Me :)


On file Sub.php  ;)

Elmacik:
anyone to make it work for smf 1.1 beta 3 ?
i couldnt find the given strings in Subs.php

[Unknown]:
Before this:


--- Code: --- array(
'tag' => 'pre',
'before' => '<pre>',
'after' => '</pre>',
),
--- End code ---

Add:


--- Code: --- array(
'tag' => 'pdf',
'type' => 'unparsed_content',
'content' => '<object type="application/pdf" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" data="$1" width="500" height="400"><param name="src" value="$1" /><a href="$1" target="_blank">$1</a></object>',
'disabled_content' => '<div>PDF: $1</div>',
'block_level' => true,
),
--- End code ---

Then, in Subs-Post.php (this may be Beta 4 and after, though...) find:


--- Code: --- // [flash]http://...[/flash]
array(
'tag' => 'flash',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
'hasExtra' => true,
),
--- End code ---

Add after:


--- Code: --- // [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),
--- End code ---

-[Unknown]

Navigation

[0] Message Index

[#] Next page

Go to full version