I've a page with a CjuiTab, with seven tabs.
I need a link into from external page or from the same page, to REFRESH the page directly a the specified tab.
I need to use ChtmlLink, but how to append '#' to end of url ?
CHtml::link (Yii::t('general','Annulla'),
array("company/update",
'id'=> $companyId)
where / how to append '#contactTab' !?
You just need to pass a '#'=>'value'. The value of the url parameter for CHtml::link is ultimately passed to CController::createUrl, and the doc states:
additional GET parameters (name=>value). Both the name and value will be URL-encoded. If the name is '#', the corresponding value will be treated as an anchor and will be appended at the end of the URL.
So try with:
CHtml::link (Yii::t('general','Annulla'),
array(
"company/update",
'id'=> $companyId,
'#'=>'contactTab'
)
);
Update: For same page links you'll need to use some javascript to reload the page after the browser url is set:
CHtml::link (Yii::t('general','Annulla'),
array(
"company/update",
'id'=> $companyId,
'#'=>'contactTab'
),
array('onclick'=>'setTimeout("location.reload(true);",100);')
);
(Not sure if this is the best way to reload though)
Related
I'm using Vuejs for frontend and I have blade template displayed using iframe. I want to send data into blade such that Whatever i type inside text field it should be displayed on the laravel blade template.
<iframe :src="template" #load="onTemplateLoad()"></iframe>
and template is defined as
this.template = '/templates/email_templates/' + t.id + '?footer_message=' + this.footer_message;
If there is any new line character in footer_message it should be displayed. Now it is ignoring the new line. Is there any way to solve it.
Anyway friends I got it, before appending the value just replace all new line character with '%0A'.
In my code I added this message.replace(/\n/g, '%0A');. Which Works fine.
I'm using GridView::widget, when I enter anything on search box inside gridview, it's creating url as below:
/v2/backend/web/index.php/agency/index?AgencySearch%5Bgovt_name%5D=&AgencySearch%5Bcity%5D=&AgencySearch%5Bmember_id%5D=22
Now I need to pass those paramters to url inside status icons present under GridView's Status column.
echo Url::to(['agency/change-status', 'id' => 33, 'set' => 11, Yii::$app->request->getQueryParams()]);
Above code is creating url as below:
/v2/backend/web/index.php/agency/33/change-status/11?1%5BAgencySearch%5D%5Bgovt_name%5D=&1%5BAgencySearch%5D%5Bcity%5D=&1%5BAgencySearch%5D%5Bmember_id%5D=22
And it makes sense because Yii::$app->request->getQueryParams() is an array. Note 1 inside url change-status/11?1%5BAgencySearch
Is there any simplest Yii way of achieving what I need instead of modifying Yii::$app->request->getQueryParams() as per Url::to() that is into string.
I'm trying to pass parameters in order to persist the state of gridview while loading contents again on grid after status change pjax request.
Use array_merge to combine your route and parameters and the search params.
$params = array_merge(['agency/change-status', 'id' => 33, 'set' => 11], Yii::$app->request->getQueryParams());
echo Url::to($params);
I have a view file add_rates.ctp and in that there is one select box . when i change the optiion, it will make a ajax call and fetch some values from the controller and load an element in that view.
but my problem is iam not getting the parameter values in the element.
i am getting params in rates.ctp
$params=$this->params['pass'];
it will return an array of parameters. but when i tried this in element i am not getting the value.
also i tried to set a value in the add_rates.ctp and try to access in element, that is also not working
$this->set('params',array($params));
what to do..if anybody have idea about this please reply.. i get stucked ...
If $params is the array you are trying to pass, then try this:
<?php $this->element('your-element-name', array('params' => $params)); ?>
I am using FormIt extra in Modx Revolution and I have an url like
.../page.html?data1=value1&data2=value2
I want to pass these values into new form on the page. How do I do that without using JS? THX
Solved using [[!FormItRetriever]] snippet..
[[!FormIt?
&hooks=`redirect`
&store=`1`
&clearFieldsOnSuccess=`1`]]
Set input value: value="[[+fi.someValue]]"
On Landing page paste: [[!FormItRetriever]] before FormIt call..
and use same input value="[[+fi.someValue]]" in form.
I have a php file under protected/views/directory_controller_name with formatting like that
<p>
<?php echo $model->title;?>
</p>
...
I display the file with classic method in the controller :
$this->render('filename',array('model'=>$model));
But know, I need to send an email with the same template/layout so I want to store the render of the file in an variable like
$msgHTML = $this->renderInternal('_items', array('model'=>$model));
But it doesn't work!
How can I get render view from a file and store in a variable?
Is it possible?
I don't want to use:
$msgHTML = '<p>'.$model->title.'</p>'
...
Because the file is very long and I don't want to duplicate code!!!
Don't use the renderInternal method, use renderPartial instead. Render internal is low level method and should not be used in such context. To catch the output just set the $return parameter to true:
<?php $output = $this->renderPartial('_subView', $dataArray, true); ?>
$msgHTML = $this->renderInternal('_items', array('model'=>$model), true);
http://www.yiiframework.com/doc/api/1.1/CBaseController#renderInternal-detail
I might be missing something, but can't you just use regular render() with the return argument set to true? Then you can just use a view 'name' instead of knowing the path. (And unless my trusty stack trace logger is broken, renderFile and renderInternal take the same fully qualified path argument. At least I can see renderPartial() passing the full path to my view file to renderFile.)
you can do this with these ways
1) if you want to get the output with header and footer (i.e ) full layout then do this
//add true in the last parameter if you want a return of the output
$htmloutput=$this->render('_pdfoutput',array('data'=>'nothing'),true);
2) similarly if you don't want to get the layout files just use renderpartial in the same way
$htmloutput=$this->renderpartial('_pdfoutput',array('data'=>'nothing'),true);
you will get the html of files in the variable . use this anywhere