• Resolved ovann86

    (@ovann86)


    I would like to use more than one template per form. I want to do this by having a default template, and then various links that include template=template1.php , template=template2.php etc.

    I setup the default using this in my configuration:

    global $gf_pdf_default_configuration;
    
     $gf_pdf_default_configuration = array(
     	'template' => 'custom-template.php',
    	'pdf_size' => 'A4'
     );

    Which works fine, but when I try to load the PDF using &template=custom2-template.php it still uses the default configuration.

    For example:

    http://domain.com/?gf_pdf=1&fid=26&lid=415&template=custom2-template.php&html=1

    I’ve read the advice here and here but didn’t find a solution, just advice implying you can do this but nothing to say if it needs specifical configuration.

    Is there something I need to do to make template= in the query string work in addition to a a default template?

    https://ww.wp.xz.cn/plugins/gravity-forms-pdf-extended/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Hi,

    You need to assign a node in your configuration.php file for each template file you want. For instance:

    $gf_pdf_config[] = array(
      	'form_id' => 1,
    	'template' => 'template1.php'
    );
    
    $gf_pdf_config[] = array(
      	'form_id' => 1,
    	'template' => 'template2.php'
    );
    
    $gf_pdf_config[] = array(
      	'form_id' => 1,
    	'template' => 'template3.php'
    );

    Thread Starter ovann86

    (@ovann86)

    Thank you for your quick response!

    I appear to have got what I wanted by using the configuration below.

    It loads ‘template1.php’ if I don’t specify template= in the query string, and if I specify template=template-html.php it loads the html template.

    Note I’m using $_GET[‘fid’] instead of a specific form id so it can be applied to any form. My system will be creating and deleting templates on an ongoing basis, and the template can be applied to any of them.

    Thanks again !

    global $gf_pdf_default_configuration;
    
     $gf_pdf_default_configuration = array(
     	'template' => 'template1.php',
    	'pdf_size' => 'A4'
     ); 
    
      $gf_pdf_config[] = array(
      	'form_id' => $_GET['fid'],
    	'template' => 'template1.php'
    );
    
     $gf_pdf_config[] = array(
      	'form_id' => $_GET['fid'],
    	'template' => 'template-html.php'
    );
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to select template using query string’ is closed to new replies.