News:

Join the Facebook Fan Page.

Main Menu

See PDF in Posts

Started by FaSan, May 13, 2005, 05:10:06 PM

Previous topic - Next topic

FaSan

Little Tips ;)



<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>



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?
"Insanity: doing the same thing over and over again and expecting different results."

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
Home of Elmacik

[Unknown]

#4
Before this:

array(
'tag' => 'pre',
'before' => '<pre>',
'after' => '</pre>',
),


Add:

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,
),


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

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


Add after:

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


-[Unknown]

Elmacik

thanks [unknown] but it give parse error :(

Parse error: parse error, unexpected ',' in /home/elmacik/public_html/forum/Sources/Subs-Post.php on line 303
Home of Elmacik

[Unknown]

Quote from: elmacik on September 03, 2005, 09:47:38 AM
thanks [unknown] but it give parse error :(

Parse error: parse error, unexpected ',' in /home/elmacik/public_html/forum/Sources/Subs-Post.php on line 303

Can you post 5 lines above and below your change to that file?

-[Unknown]

Elmacik

here are the lines above, lines themselves, lines below;


// [flash]http://...[/flash]
array('tag' => 'flash', 'protocol' => 'http', 'embeddedUrl' => false, 'hasEqualSign' => false, 'hasExtra' => true)
);
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),

// Fix each type of tag.
Home of Elmacik

dtm.exe

Quote from: elmacik on September 04, 2005, 05:06:48 PM
here are the lines above, lines themselves, lines below;


// [flash]http://...[/flash]
array('tag' => 'flash', 'protocol' => 'http', 'embeddedUrl' => false, 'hasEqualSign' => false, 'hasExtra' => true)
);
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),

// Fix each type of tag.


Should that last comma not be a semicolon?

Joshua Dickerson

That semicolon should be a comma
Come work with me at Promenade Group



Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

[Unknown]

Don't add the code in Subs-Post.php.  As I described, it doesn't apply to your version.

-[Unknown]

Elmacik

#11
Quote from: OIDanTheManIO on September 04, 2005, 05:45:38 PM
Should that last comma not be a semicolon?

no, as i tried replacing the semicolong that is placed at the end of [flash] and i put a semicolon instead of the comma in the codes that [unknown] gave. its no use.
Quote from: groundup on September 04, 2005, 05:45:38 PM
That semicolon should be a comma

i tried but not to make [unknown] say "you havent done like i said" i just didnt post it.

Quote from: [Unknown] on September 04, 2005, 05:51:15 PM
Don't add the code in Subs-Post.php.  As I described, it doesn't apply to your version.

-[Unknown]

please look above, i asked for 1.1 beta 3, you gave the codes and now you say "it doesnt apply to your version" not weird in your opinion too? :)
Home of Elmacik

[Unknown]

Quote from: [Unknown] on September 03, 2005, 03:57:40 AM
Then, in Subs-Post.php (this may be Beta 4 and after, though...) find:

As I said.

It will still work, just don't make that change.

-[Unknown]

Elmacik

which change?
you mean even if i DONT put the codes (i dont use anywhere..) still pdf will work?

how can it if there isnt a [pdf] description tag in subs-post.php?
i couldnt get the point can you please clarify?
Home of Elmacik

Joshua Dickerson

Looking at my copy of beta 3 / 4 ...
// [ftp=ftp://...]name[/ftp]
array(
'tag' => 'ftp',
'protocols' => array('ftp', 'ftps'),
'embeddedUrl' => true,
'hasEqualSign' => true,
),
// [flash]http://...[/flash]
array(
'tag' => 'flash',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
'hasExtra' => true,
),
// [pdf]http://...[/pdf]
array(
'tag' => 'pdf',
'protocols' => array('http', 'https'),
'embeddedUrl' => false,
'hasEqualSign' => false,
),
);


You should probably grab a new copy or maybe it is only for Beta 4.
Come work with me at Promenade Group



Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

Elmacik

you mean [pdf] [/pdf] tags are already included in beta 3? so why are the codes given when i asked for 1.1 beta 3 ???

your codes are beta 4 i think and public dont have it.
Home of Elmacik

[Unknown]

No.  As I said, you make the change to Subs.php, but not the change to Subs-Post.php.  That's all you need to do.  That is what I said.

-[Unknown]

Elmacik

i made the change in subs.php and didnt touch subs.post.php
now it shows the exact words i typed. while posting, i write  [pdf]http://something/something.pdf[/pdf]

it shows what i type just like;  [pdf]http://something/something.pdf[/pdf]

if there is no need, why did you sent that codes for subs.post.php .. ? sorry for my dumbness but couldnt still understand.
Home of Elmacik

ivo2296

Would be if someone let me know how to make this work for smf 1.0.7 and 1.0.5.


Thanks!

ivo2296

Any chance for smf1.1.3 ?


Thanks!

Advertisement: