Title: gview called using do_shortcode
Last modified: August 22, 2016

---

# gview called using do_shortcode

 *  [DavidSadler](https://wordpress.org/support/users/davidsadler/)
 * (@davidsadler)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/gview-called-using-do_shortcode/)
 * I’m a WP newbie and have struggled learning use of plug-ins and PHP. I need to
   call gview using do_shortcode
 * [insert_php]
    . . . do_shortcode(‘[gview(file=”[http://inbiomedtech.com/wp-content/uploads/2014/09/Sustainability-Flyer-Draft.docx&#8221](http://inbiomedtech.com/wp-content/uploads/2014/09/Sustainability-Flyer-Draft.docx&#8221);)]’);[/
   insert_php]
 * I’m getting a blank page – no output. Can anyone help?
 * Thanks in advance
 * [https://wordpress.org/plugins/google-document-embedder/](https://wordpress.org/plugins/google-document-embedder/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [k3davis](https://wordpress.org/support/users/k3davis/)
 * (@k3davis)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/gview-called-using-do_shortcode/#post-5267928)
 * Hello David,
 * Usually you don’t need to use the do_shortcode method, but I will trust you know
   what you’re doing. 😉 However please just use the standard GDE shortcode inside
   the command. I seee you have parenthesis around the file= attribute and its value,
   and this shouldn’t be necessary.
 * Hope this helps.
 * Kevin
 *  Thread Starter [DavidSadler](https://wordpress.org/support/users/davidsadler/)
 * (@davidsadler)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/gview-called-using-do_shortcode/#post-5267935)
 * Thanks Kevin for responding. I’m afraid I didn’t do a good job asking my question.
 * If I need to bring up gview in a new page for each different document I want 
   to show, how is the best way to do that? I was thinking of having a “Doc View”
   page that is called with a file name. Then in the Doc View page would the correct
   code be this –
 * [insert_php]
    echo do_shortcode(‘[gview(file=’. $_REQUEST[‘f’] .’)]’); [/insert_php]
 * Or, is there a way to call gview in-line using a short code where it launches
   in a new window – [gview(file=2014/09/Sustainability-Flyer-Draft.docx)], target
   =”viewer”)] ?
 * Thanks again
 *  [k3davis](https://wordpress.org/support/users/k3davis/)
 * (@k3davis)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/gview-called-using-do_shortcode/#post-5267949)
 * Hey David, I’ll be honest I’ve never tried the method you’re attempting here 
   so I don’t have a ready guaranteed fix, but I’m still puzzled by the parenthesis
   you’re using… does it not work with something like the below?
 * `echo do_shortcode('[gview file="'. $_REQUEST['f'] .'"]');`
 * Meaning, wrap your do_shortcode command in parenthesis but not the shortcode 
   attributes themselves. If you’re getting the value of ‘f’ from the query string
   you may also have to urldecode it first:
 * `echo do_shortcode('[gview file="'. urldecode($_REQUEST['f']) .'"]');`
 * You may have to experiment with just echoing the shortcode itself to the page
   to make sure it’s rendering correctly in the page source before wrapping it in
   do_shortcode, just to try to pinpoint the source of the problem. In the page 
   source this:
 * `echo '[[gview file="'. urldecode($_REQUEST['f']) .'"]]');`
 * should look like this:
 * `[[gview file="http://whateverurl.com/doc.pdf"]]`
 * without any special characters (denoted by % signs and numbers), HTML, PHP messages,
   or other junk. (Note the double bracket thing [[…]] is probably optional in this
   case but can be used within the wordpress “loop” to show the shortcode on the
   page instead of actually rendering its results.)
 * GDE is an embedded viewer (hence its [poorly chosen] name) so it wouldn’t make
   sense for it to automatically open another window based on the shortcode, but
   you can of course make the link to the page you’re creating open in a new window
   using target=, or set the default profile of the full screen button to open in
   a new window when they enlarge the viewer, etc.
 * If that doesn’t get you anywhere let me know where it does get you and I’ll see
   if I can come up with any other suggestions.
 * Best of luck,
 * Kevin
 *  Thread Starter [DavidSadler](https://wordpress.org/support/users/davidsadler/)
 * (@davidsadler)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/gview-called-using-do_shortcode/#post-5267966)
 * Thanks again Kevin for helping. These versions yielded no errors and a blank 
   page –
 *  echo do_shortcode(‘[gview(file=”‘. $_REQUEST[‘f’] .'”)]’); (quotes around the
   variable)
    echo do_shortcode(‘[gview(file=”‘. urldecode($_REQUEST[‘f’]) .'”)]’);
 * Then I tried – echo ‘[[gview file=”‘. urldecode($_REQUEST[‘f’]) .'”]]’); and 
   it yielded the correct code. Then I went back to the origial – echo do_shortcode(‘[
   gview(file=”‘. urldecode($_REQUEST[‘f’]) .'”)]’); which yielded a no errors and
   a blank screen. Then I used the browser de-bugger to inspect the code sent to
   the page and bingo. The code is encapsulated with <p>…</p>.
 * I said I’m a newbie when it comes to WP. What would be the correct way to disable
   the the auto encoding?
 *  [k3davis](https://wordpress.org/support/users/k3davis/)
 * (@k3davis)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/gview-called-using-do_shortcode/#post-5267982)
 * What does this code do?
 * `echo do_shortcode('[gview file="'. urldecode($_REQUEST['f']) .'"]');`
 * or alternately
 * > $sc = ‘[gview file=”‘. urldecode($_REQUEST[‘f’]) .'”]’;
   >  echo do_shortcode(
   > $sc);

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘gview called using do_shortcode’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/google-document-embedder_484848.svg)
 * [Google Doc Embedder](https://wordpress.org/plugins/google-document-embedder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-document-embedder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-document-embedder/)
 * [Active Topics](https://wordpress.org/support/plugin/google-document-embedder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-document-embedder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-document-embedder/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [k3davis](https://wordpress.org/support/users/k3davis/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/gview-called-using-do_shortcode/#post-5267982)
 * Status: not resolved