Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 4    Views: 58


Lost but trying
Profile
Posts: 10
Reg: Jan 18, 2013
Sydney, Austral...
6,100
07/15/13 04:04 PM (12 years ago)

Dynamic URL for PDF

Hi, I'm fairly new to Buzztouch and was wondering if there was any way to create a dynamic URL for the PDF plugin. Ideally, I'd like to be able to point to a pdf file where the filename is based on a date selected by the user in the app. Does anyone have any suggestions on how to do this either with the PDF plugin or perhaps another solution? Cheers.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/15/13 06:05 PM (12 years ago)
It would be easier to do on the server side... but yes, it can be done. Setup your link in the pdf plugin 'dataURL' as a static link (http://www.myserver.com/mypdf.php?date=01012013) Then, on the server side, have your 'mypdf.php' page parse the date request and 'feed' the correct document to the user, based on date, or whatever you feel pertinent. Make sense? Let me know if you have questions. Cheers! -- Smug
 
Annonymous
Profile
like
07/15/13 07:08 PM (12 years ago)
Thanks. I can see what you mean, but then wouldn't the problem then be how to change the date in the dataURL that is passed to the php? Cheers, Gaz.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/15/13 07:51 PM (12 years ago)
you said 'filename based on a date selected by the user'. How were you planning on retrieving the date? Are they recent dates, or something that happened in 1885? Regardless, figure out how you want the users to select the date, and then you can figure out how to pass that date as part of your URL Query string. The php can figure out which file to send depending on the date value. Cheers! -- Smug Edit: Read up a little on 'loadScreenObject', a BT method that allows you to dynamically create a screen that isn't already configured. I use it extensively in my location based apps, which provide menu choices depending on a persons physical location. Think 'restaurants near me'.
 
Annonymous
Profile
like
07/15/13 09:02 PM (12 years ago)
Thanks Smug - that sounds like a good place to start. You're right, I still need to figure out exactly how to work out how the user will select the dates, but the idea is basically that a growing number of pdfs will be on a server somewhere and the app will be able to pick the latest one and then offer the user a list of historical ones. It's just an idea on paper at the moment and the PDF plugin seemed like a good place to start (and still does) so I'll have a look at the BT method you suggest and see if will do what I need. Even if it doesn't it will give me a good chance to get my hands dirty. Thanks again.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.