PDF Custom Name

sunnyjey

Active Member
This is with reference to this Thread : http://fabrikar.com/forums/index.php?threads/change-file-name.45847/

The solution is given in the thread is working.

My questions:

1. What is correct code to add multiple elements in the PDF name ?
Code:
echo $d->model->data['yourtable___last_name'];

I tried, but didn't work. It shows Array in place of second field element.

Code:
echo $d->model->data['yourtable___last_name']['yourtable___city'];

2. If Element value is John Philips (with a space between two names). The space is replaced by %20. So PDF name becomes John%20Philips. It doesn't look professional.

Is there any way to remove this %20 and replace with _ or -
 
Whenever you get a situation where you aren't sure what format the data is in, dump it out and take a look. So do ...

var_dump($d->model->data['yourtable___last_name']); exit;

... and see what the format is, which should tell you what you need to use.

You can run you values through str_replace ...

echo str_replace(' ', '', $yourTitle);

-- hugh
 
Thank you for your great support. I'm learning new things every day.

I must say, this is the most amazing component, I have ever worked. It has got infinite possibilities.
 
Yesterday night again, we tried hard to append values of any two elements from the form to produce Name of PDF Detail template. Tried all combinations, but, still couldn't figure out.

Please help.
 
Put ...

Code:
var_dump($d->model->data); exit;

... copy and paste that output here, and tell me what element you are trying to use in the title.

-- hugh
 
Data Dump

Code:
array(67) { ["mytable_reports___ptid"]=> string(5) "wbc9f" ["mytable_reports___ptid_raw"]=> string(5) "wbc9f" ["mytable_reports___download"]=> string(0) "" ["mytable_reports___download_raw"]=> string(0) "" ["mytable_reports___cid"]=> NULL ["mytable_reports___cid_raw"]=> NULL ["mytable_reports___pt_name"]=> string(14) "John Pillips" ["mytable_reports___patient_name_raw"]=> string(14) "John Pillips" ["mytable_reports___age"]=> string(19) "38 yrs / Male" ["mytable_reports___age_raw"]=> string(19) "38 yrs / Male"

what element you are trying to use in the title
1. ["mytable_reports___pt_name"]
2. ["mytable_reports___age"]
 
In PHP, you concatenate strings with the . operator.

Fabrik has a helper function, iclean(), which replaces all non alpha-numeric characters (numbers and letters) except - and _ with _.

Code:
echo FabrikString::iclean($d->model->data['mytable_reports___pt_name'] . ' ' . $d->model->data['mytable_reports___age']);

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top