From the course: PHP: Exporting Data to Files
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Offering a choice of download formats - PHP Tutorial
From the course: PHP: Exporting Data to Files
Offering a choice of download formats
Throughout this course, we've always concentrated on exporting to a specific format. This is usually sufficient because Microsoft Office, Open Office and Libra Office, all use variations of open document format, so spreadsheets and text files are generally interoperable. They can also open CSV, plain text, and RTF files. But offering users a choice, is easy with PHP. I've opened flowers_choice.php, which you can find in the Exercise Files for this video. It's the same as flowers_word.php with the addition of a Select menu at the bottom of the HTML. So if we scroll down to the bottom, There is the select menu. It has the name format, and two options, Ms Word, and opendoc. So, all that's necessary to offer users a choice of download format, is to create a conditional statement in the code that processes the download. So let's go back to that code. We're going to be creating an ODT file as well as a Word file. So, we need to import the OpenDoc class. So, add a new line after line nine…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Creating a .docx file to use as a template3m 37s
-
(Locked)
Extracting the main content file from a Word document5m 28s
-
(Locked)
Formatting the main content file3m 38s
-
(Locked)
Converting the main content file to XSLT6m 18s
-
(Locked)
Outputting the database result as a .docx file6m 4s
-
(Locked)
Offering a choice of download formats3m 55s
-
(Locked)
-