I wan to embed a pdf file to node.

Users would create node, attach a pdf file, a cck field automatically grabs the pdf file and embeds in a good format using etc

I am not good at coding please help me out.

Is there any way we can do this through contemplate?

Comments

marcvangend’s picture

Why don't you just use the core upload module?

marcvangend’s picture

Why don't you just use the core upload module?

himtuna’s picture

Core has a brilliant upload module to simply attach files to a node.
But I would like to display the attached pdfs either in the cck field or in the node itself using contemplate.
But dont know how to do it, Please let me know I am dying for this feature. The entire site depends on it.
I can myself embed using html but I don't expect users of the site to be able to do that.
Regards
himtuna

barrett’s picture

I know jack about contemplate, but have you looked at Fast Gallery? It says "Supports PDFs using Lightbox iframe. Requires Adobe Reader installed in your browser."

himtuna’s picture

Thanks buddy!
But its still not what I want. Because users then have to be taught to use rel="lightframe" in the a href!

I just want to have a simple php code which will be put in the cck fields default value. which takes the attached pdf and displays them in the page as embeded object.
or we can do it via contemplate

josesanmartin’s picture

So copy JS/CSS from Fast Gallery and insert rel="lightframe" in your theme/contemplate.

José San Martin
http://www.chuva-inc.com/

José San Martin
http://www.chuva-inc.com/

marcvangend’s picture

Exactly, just use the core upload module and do whatever you need to do with the file's url in contemplate.

himtuna’s picture

The file attachment didnt help me straightway.
I had to use cck file field to upload the pdf and using contemplate I created a template to get the display.

I dont know php still i managed to do it!
Rocking Drupal!

thedawn’s picture

It would be great if you could share just how you did this with the community ...

mcfilms’s picture

It would be wonderful to hear how a non-php programmer solved this problem.

A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com

himtuna’s picture

what I did :-

You need cck and content template

1) Created a cck field 'field_file_pdf' or giveit whatever you want.
2) Now go to contemplate admin page( I don't have it installed right now, so can't tell the exact path,)
3) create a template for you desired content type.
4) then go ahead add this line after
<?php print $body ?> ( i hope its correct)
then simply add the html code for embedding the pdf, in the path for the pdf file, print out the full path of the attached file.( go and look at the available variable list)
the pdf code looks something like

<embed width="600" height="400" src="<?php $.... the variable to your attached file?> ">

I am not on the right system, so can't see the exact code that I used on my test site. If you don't get the pdf working just reply I'll post the exact steps.

[Edited to add <code> and </code> tags; nevets]