Uploading documents for download

10 posts by 2 authors in: Forums > CMS Builder
Last Post: May 9, 2010   (RSS)

By svsanchez - May 5, 2010

Hello, I became a happy customer after purchasing AM so I decided to try CMS Builder for 2 of my clients thinking it would be as easy to work with as AM, but I'm really confused by the program. I'm sure that when I finally understand how it works it will be a great product, but for now I need some guidance in creating a section where my customer can upload documents (in pdf, word, excel, etc...) and listing them with a title, description, an icon depending on the type of file and allowing users to download the documents.

I created an html file showing how it should look here: http://www.observatoriodsan.org/dummy.htm

Can you tell me how to do this please!

Thank you!
Sven Sanchez

www.deguate.com

Re: [gkornbluth] Uploading documents for download

By svsanchez - May 5, 2010

Hello, thank youy for your instructions, I tried them however it didn't work. I am getting this error message:

Notice: Undefined index: gestion_del_conocimiento in /home/observat/public_html/dummy.php on line 53 Warning: Invalid argument supplied for foreach() in /home/observat/public_html/dummy.php on line 53

Here's the link: http://www.observatoriodsan.org/dummy.php
Sven Sanchez

www.deguate.com

Re: [svsanchez] Uploading documents for download

By gkornbluth - May 5, 2010

Sorry it didn't work as planned,

Let's start simple.

If you paste the entire code generator code into a blank test.php document does that work at all?

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Uploading documents for download

By svsanchez - May 5, 2010

Hello, when I create a blank page with the code (or a page with the design on it) and paste the code generated by the Code Generator it gives me no error, but when I replace the code generated by the Code Generator with the code you sent me I get the error. Here's the blank page I created with the code you sent me:

http://www.observatoriodsan.org/gestiondetail.php
Sven Sanchez

www.deguate.com

Re: [svsanchez] Uploading documents for download

By gkornbluth - May 5, 2010 - edited: May 5, 2010

And you created some records as samples? I'll mock up a page and see what I get
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Uploading documents for download

By svsanchez - May 5, 2010

Hello, yes I created 2 records and uploaded a pdf file for each!
Sven Sanchez

www.deguate.com

Re: [svsanchez] Uploading documents for download

By gkornbluth - May 5, 2010

Hi svsanchez ,

If you take a look at http://artistsofpalmbeachcounty.org/PDF_Test.php you'll see the result of following the instructions I offered above, copying the entire code generator code, followed by pasting in the body code in my suggestion. They both seem to work.

Check everything again and I'm sure that you'll find the discrepancy.

Good luck,

Don't get too discouraged.


Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Uploading documents for download

By svsanchez - May 9, 2010

Hello, I think I figured it out, the problem seems to have been the "type" of field. You said it had to be "Text Box" and I had it as "Wysiwyg". Changing that corrected the issue!

Now on the "if" statements to show a "PDF" icon, "Word" icon, etc... can you help me on doing that?

Thank you again!
Sven Sanchez

www.deguate.com

Re: [svsanchez] Uploading documents for download

By gkornbluth - May 9, 2010 - edited: May 9, 2010

Hi svsanchez,

Glad it's working. WYSIWYG fields can be a bit tricky.

You could upload all the icons you want to use into a folder called “images” in your sites root directory.

Then, inside the upload foreach loop, where you want to show the icon, you could use something like the following:

<?php if ($upload['extension'] == 'pdf'): ?>
<img src="http://www.your_site/images/pdf.jpg" width="nn" height="xx" />
<?php if ($upload['extension'] == 'doc'): ?>
<img src="http://www.your_site/images/doc.jpg" width="nn" height="xx" />
<?php else: ?>
<img src="http://www.your_site/images/other_format.jpg" width="nn" height="xx" />

<?php endif ?>


Hope that gets you going.

Best,

Jerry Kornbluth
<?php if ($upload['extension'] == 'swf'): ?>
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php