Gravity PDF & Gravity Perks Nested Field - pdf

I'm using Gravity PDF and have a Nested field from Gravity Perks. I can view fields in the normal exploded results just fine, but am having trouble when I want to display the Nested field in a particular location using the PHP option.
To be clear, I can get the normal $form_data['field'] and $form_data['list'] options to work just fine. But when I try to get one of those to fire a Gravity Form Nested Field I have issues. I've used a lot of combinations...
<?php echo $form_data['field'][27.72]; ?>
<?php echo $form_data['gpnf'][27]['gpnf']; ?>
<?php echo $form_data['field'][27]['gpnf']; ?>
<?php echo $form_data['field']['gpnf_display_value_27_72']; ?>
Thoughts?

Got it! Got it working earlier today and been fiddling with it all day. Just had to setup an API. First you use the original $form_data to get the Entry_ID
$client = $form_data['field'][32];
Then you point the API to the form_id you want:
$form_id2 = '27';
$entry2 = GFAPI::get_entry( $client );
And then it was a really easy variant of the rgar:
You need to setup $form_id2 and $entry2 or something like that because if you don't it changes the other ones in the PDF that are pointed at the original Form.
From here I've been able to customize the heck out of it.

Don't know the answer, but I use gravity forms and perks, and the perks support is really good and usually get back quickly with a response. Might try emailing them if you haven't already.

Related

form suddenly not posting correctly yii

it was working fine the past few weeks but i have no idea what happened...
Every time I submit it gives me user_product_id cannot be blank.
<?php echo $form->dropDownList($model,'user_product_id',
CHtml::listData(Product::model()->findAllByAttributes(array('store_id'=>$store_id)),'product_id','product_name'),
array('prompt'=>'Select Your Product'));
?>
Not sure if this is related to the same problem, but within the same controller, it also gives me an error saying trying to get non-object, when it is an object.
$model->target_id = Product::model()->findbypk($product_id)->name_id;
var_dump gives me an integer for $product_id as well as the entire expression...

Joomla remove scripts and css loaded by extensions

Using Joomla 2.5 and I have a dual instance of jquery running on one of my pages that I would like to get rid of. I tried using,
$document->getHeadData();
to no avail. The array does not contain the js files I need to unset. So what is my best option to find the js file and unload it? It seems to be getting loaded later in the page rendering process and then repopulating the head data. I am using a yoo theme template with some other extensions loaded.
I would like to avoid hard coding the template/extension files if possible since that would unload it on every page and I only want to unload it for one page.
Try this,
<?php
//get the array containing all the script declarations
$document = JFactory::getDocument();
$headData = $document->getHeadData();
$scripts = $headData['scripts'];
unset($scripts['/media/system/js/mootools-core.js']);
unset($scripts['/media/system/js/mootools-more.js']);
$headData['scripts'] = $scripts;
$document->setHeadData($headData);
?>
Or
<?php unset($this->_scripts['/media/system/js/mootools-core.js']); ?>
then simply use $document->addScript() for adding new js files.
hope its works..

giving ID and/or other variables for each php page

Is there a simple php coding way how to add variable(s) "dynamic or fixed types" to include in a link so that the link doesn't show up as a clean url. And this an example of what I mean:
www.example.com/folder/sense/home
To
www.example.com/folder/sense/index.php?type=article&id=25&date_written=20100322
Or
www.example.com/folder/sense/index.php?id=25
I hope it is clear what I'm up to.
P.S: this is all in Apache
Thanks
The http_build_query function (http://php.net/manual/en/function.http-build-query.php) will convert an array of data into an urlencoded string of variables.
Example from the link above:
<?php
$data = array('foo'=>'bar',
'baz'=>'boom',
'cow'=>'milk',
'php'=>'hypertext processor');
echo http_build_query($data) . "\n";
?>
will output
foo=bar&baz=boom&cow=milk&php=hypertext+processor
I am not sure i get it, but if you use a form with post, $_POST array will keep variables and they will not be visible in the url

Caching Values of MySQLin Browser

I am creating a website in which user enters his position(which can only be the ones stored in my database). To make it user friendly, I want to show him the available choices of positions as he types the positions. Is there a way to cache all the values in SQL(around 30 to 40) in browser beforehand, so that user can see them while typing.
You can query your data base through PHP and most other server side scripts and call them through ajax. You can also use pure javascript with the new html5 specs (but they are only supported in webKit browsers at the moment).
If you want to do it without ajax, you can get the values when the user accesses the page and put them in a javascript array. This way when the computer reads the javascript the custom values are already there. The problem with this meathod is it will significantly slow your websites response time.
Example: (php/pesudocode)
<?php
$options = $mysql->getOptions(); // This is the pesudo-code bit.
echo 'options = [';
foreach ( $opt in $options )
{
echo '"' . $opt.name . '"' . ',';
}
echo '];"
?>
This gives something like
options = [ "opt1", "opt2", "opt3", ];
which should be read as an array in javascript. The only problem is the extra comma but you should be able to solve that easy enough. (and firefox didn't even give a warning)

How can I use Zend Layout with Zend View if I call the view from a model?

Basically, I want to render a view and layout from a model. Don't ask me why.
First of all, the views work as intended and I'm loading them into a variable for my perverse use later on. I am also fully aware that I could always do partial scripts. It seems to be a valid fallback, but it just doesn't cut it.
What I want to do is to get the layout to work automatically just like in the case with controllers and views.
Right now I employ something like this:
// Class blablabla
$layout = new Zend_Layout();
$layout->enableLayout();
$layout->setView($view);
// Ugly url, I know, I'm experimenting and they work
$body = $layout->render('mailer/layout/mail');
$body .= $view->render('mailer/templates/' . $type . '.phtml');
The problem is that $body contains the layout and only then the actual view. Any advice? What am I doing wrong?
Assuming that your layout contains the default $this->layout()->content somewhere, you'd want this:
$layout->content = $view->render('...');
$body = $layout->render('...');
Source: http://www.wowww.ch/2009/03/16/zend-mail-avec-template-standardise-avec-zend-layout-et-zend-view/
I think my first note would have to be that you're trying to use a hammer as a screwdriver. As I'm sure you know, in the MVC model the view is the rendering, and is logically distinct (separate) from the model. I'm not sure you're going to find a happy solution to this, since you're crossing the streams.