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..
Related
i'm using WHMCS and i want to make some changes in part of the page but its so hard and takes so much time for me to find the right tpl file and edit it in the template.
for example for this "search for domains" tab in this url =>
example.com/cart.php?a=add&domain=register
where is the .tpl file.
For example.com/cart.php?a=add&domain=register the file is at templates/orderforms/standard_cart/adddomain.tpl
In general, when url has cart.php, the file in cart template.
Also, you can add the following to hooks to tell you which tpl file was used for current page.
1- Create file includes/hooks/tpl_locator.php
2- Add the following code:
<?php
add_hook('ClientAreaPage', 1, function($vars) {
error_log(print_r([$vars['currentpagelinkback'],$vars['templatefile']], true), 3, __DIR__.'/tpl_file_location.log');
});
3- Visit the page you want to know which tpl file is used.
4- Result will be at file includes/hooks/tpl_file_location.log, sample below:
Array
(
[0] => /cart.php?a=add&pid=1&
[1] => configureproductdomain
)
This was tested on WHMCS 8.0
The tpl for cart.php?a=add&domain=register is actually located at /whmcs/templates/orderforms/standard_cart/domainregister.tpl if I understand your question.
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.
I have a template file that I fill using PHPExcel. But I have terms and conditions that are saved in database with html tags and inline css. Now these terms and conditions are subject to change so I cant put it into template. So only solution is t take it from database and put it inside created template but I have no clue how to open xlsx file and insert .html file inside it perhaps as second sheet.
This is my current code:
$objPHPExcel = new PHPExcel();
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save($outputFileName);
And of course there is lot of code that specifically deal with writing data to excel file but that is working perfectly.
Could someone please explain how could I go about doing it.
Thanks
You can't simply insert an HTML file inside an xlsx file
The latest develop branch of PHPExcel does include an HTML to Rich Text wizard that will take a block of HTML markup and convert it to a Rich Text object that can then be stored in a cell, and /Examples/42richText.php demonstrates how it can be used. At present, this only covers basic markup tags (<br />, <font>, <b>, <i>, <em>, <strong>, <sub>, <sup>, <ins>, <del>, etc) and doesn't handle inline style in any way. However, it might provide the basis for what you want with some additional work.
I'm having custom footer module in my template. Also i'm using testimonial module in the position content bottom. I'm trying to display testimonial inside custom footer.
To do this i simply copied testimonial.tpl and testimonial.php contents and pasted into customfooter.tpl and customfooter.php
After this i'm getting errors stating
undefined variable and class name already assigned error
Did you know how to do this?
See this answer for how to do use a module in a separate modification/controller
opencart - How to manually display a module inside a template file?
You simply need to change from the common/home to your module's controller and view files
please define variable.
how can you define i will show you.
catalog > controller > header.php
for static variable
$this->load->language('common/header');
$data['text_home'] = $this->language->get('text_home');
// Where language file in assign this variable with different language foler
$data['text_home'] = $this->url->link('information/contact');
and you can tpl file in use this varible.
<?php echo $text_home; ?>
make sure 100% erorr has not facing
for dynamic variable
I'm generating pdf file with IoTcpdfBundle using Symfony2, but there's a strange behaviour that I don't understand.
When I'm on the controller, I generate the pdf file like this:
$html = $this->renderView('MyBundle:Docs:solicituddevacaciones.pdf.twig', array());
return $this->get('io_tcpdf')->quick_pdf($html);
Those lines generate the pdf file. Everything's fine, I can right click on the file to save it and it's a .pdf file.
But when I receive some data using a form, and I put the lines inside the:
if ($request->getMethod() == 'POST') {
$year = $this->get('request')->request->get('year');
$date= $this->get('request')->request->get('date');
$html = $this->renderView('SoflaSoflaBundle:Documentales:solicituddevacaciones.pdf.twig', array());
return $this->get('io_tcpdf')->quick_pdf($html);
}
When I right click on the file to save it, it's not a .pdf file, the browser suggests that I should save the file as a .htm
Why is this happening? I need users to be able to save the files as .pdf files.
Need help with this please.
I had some similar problems and found out that the bundle might be outdated by now. I had to change some of the settings, most importantly adding another header to quick_pdf function of Tcpdf class in 'Helper' folder of the bundle:
$response->headers->set('Content-Disposition', 'attachment; filename="'.$file.'"');
Now it's working like a charm, calling it in the controller like:
$html = $this->renderView('Bundle:Item:print.pdf.twig', array(
'some' => $this->value,
));
return $this->get('io_tcpdf')->quick_pdf($html, "yourFileName.pdf");
Try to save the html (or better yet, left click instead of right click) and check the contents of that file. You probably have an error in ther somewhere, and that html file is the one generated by symfony to explain the error.