Joomla 3.0 and modules.php: static variable(2d) and caching - output error - joomla

I have the following problem:
I use Joomla 3.0.1 and my own developed Template(with bootstrap). When I turn the normal Joomla caching to on, my site has output errors. These errors are regarding to the modules.php from my template, because I use a static variable(array) to save all loaded module positions and the calulated or preseted spans for bootstrap in an 2 dimensional array. Like this:
top ->2,4,6
left ->3,3,3,3
right ->4,4,4
bottom ->1,2,3,4,2
header ->12
footer ->6,6
Without caching it works perfect, but when i turn it on, i have following errors:
Notice: Undefined index: logo in
/root/templates/jooag_workframe30/html/modules.php on line 82
Notice: Undefined index: mainmenu in
/root/templates/jooag_workframe30/html/modules.php on line 72
I know what this means and where to look, but i have no solution to fix this.
The modules.php code is here:
http://pastebin.com/s4tjXcKR
The entire template is here:
http://www.mediafire.com/?qrkbatdcbs4iq2v

If a position doesn't contain any modules (ie $modCount = 0) the $spanMatrix array won't have its key, so you should be checking whether it exists before trying to access it
I suggest you wrap lines 72-75 AND line 82 of your modules.php in the following statement:
if( isset( $spanMatrix[$modPosition] ))
{
.....
}
Let me know if it works

Related

Joomla - Fatal error: Class 'JParameter' not found

I'm trying to upgrade Joomla 2.5.22 to 3.5.1, and last time I checked the progress bar, it was 86 %. I looked away for a moment and when I came back to check I saw the below error message.
Fatal error: Class 'JParameter' not found in
/home/mywebsite/public_html/plugins/system/bigshotgoogleanalytics/bigshotgoogleanalytics.php on line 24
What is the cause of this error and how would it be fixed?
Joomla can't find JParameter Class, so you have to use
jimport( 'joomla.html.parameter' );
before using JParameter class
bigshotanalytics is one of those plugins that cause a blank page or, at best, a fatal error when updating Joomla. This is because of its old code. I suggest you move the tracking code to your template. You can also add the tracking code to a custom HTML module (after removing the encapsulating div through an override) and then assign the module to a position in your template (the position should be in the section of the HTML).
Now to answer your question, Joomla no longer uses JParameter - it uses JRegistry instead. So something like:
$jparameter = new JParameter('param1');
Should be changed to:
$jregistry= new JRegistry();
$jparameter = $jregistry->get('param1');

PHPWord + dompdf "Unable to load PDF Rendering library" and "dompdf_config.inc.php" problems

I'm using PHPWord (https://github.com/PHPOffice/PHPWord) to generate a Microsoft Word file (.docx) which I save to my system. This works perfectly and as expected. I also want to save an Adobe Acrobat version of that file (.pdf) to my system. For that I'm relying on PHPWord in conjunction with dompdf (https://github.com/dompdf/dompdf). That's where the trouble begins.
My PHP code is the following:
// first, save the completed .docx file that I've generated
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, "Word2007");
$objWriter->save($path_docx);
// second, set PHPWord PDF rendering variables
\PhpOffice\PhpWord\Settings::setPdfRendererPath("/var/www/html/vendor/dompdf/dompdf");
\PhpOffice\PhpWord\Settings::setPdfRendererName("DomPDF");
// third, load the .docx file which we just saved above
$phpWord = \PhpOffice\PhpWord\IOFactory::load($path_docx);
// fourth, save the new PDF file to the location of choice
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, "PDF");
$xmlWriter->save("/var/www/html/export/my-pdf-version-of-the-file.pdf");
When I run the code above I get the following error:
Fatal error: Uncaught exception 'PhpOffice\PhpWord\Exception\Exception' with message 'Unable to load PDF Rendering library' in /var/www/html/vendor/phpoffice/phpword/src/PhpWord/Writer/PDF/AbstractRenderer.php:94 Stack trace: #0 /var/www/html/vendor/phpoffice/phpword/src/PhpWord/Writer/PDF.php(65): PhpOffice\PhpWord\Writer\PDF\AbstractRenderer->__construct(Object(PhpOffice\PhpWord\PhpWord)) #1 /var/www/html/vendor/phpoffice/phpword/src/PhpWord/IOFactory.php(44): PhpOffice\PhpWord\Writer\PDF->__construct(Object(PhpOffice\PhpWord\PhpWord)) #2 /var/www/html/assets/core/phpword.php(593): PhpOffice\PhpWord\IOFactory::createWriter(Object(PhpOffice\PhpWord\PhpWord), 'PDF') #3 /var/www/html/export/index.php(94): exportOutline(Array) #4 {main} thrown in /var/www/html/vendor/phpoffice/phpword/src/PhpWord/Writer/PDF/AbstractRenderer.php on line 94
I began searching Google for errors similar to this and came upon this Stack Overflow post: PHPWord to PDF not able to load library. They suggested editing some code within the "/var/www/html/vendor/phpoffice/phpword/src/PhpWord/Writer/PDF/AbstractRenderer.php" file. The code snippet referenced in that post is the following:
public function __construct(PhpWord $phpWord)
{
parent::__construct($phpWord);
$includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile;
if (file_exists($includeFile)) {
/** #noinspection PhpIncludeInspection Dynamic includes */
require_once $includeFile;
} else {
debug($includeFile);
// #codeCoverageIgnoreStart
// Can't find any test case. Uncomment when found.
throw new Exception('Unable to load PDF Rendering library');
// #codeCoverageIgnoreEnd
}
}
They suggested I get rid of this portion of the code which appears on the 4th line above:
. '/' . $this->includeFile
When I implemented that solution, however, it didn't fix my problem. Frustrated, I then looked at the value generated for $includeFile within that snippet of code. For me, the value was "/var/www/html/vendor/dompdf/dompdf/dompdf_config.inc.php". Once I saw that it was trying to include a file called "dompdf_config.inc.php" I then searched my directory for the file. It wasn't at the referenced location nor anywhere in my system!
At that point I began searching Google again for that file name and ended up on this Stack Overflow post: I Can't Find dompdf_config.inc.php or dompdf_config.custom.inc.php for setting "DOMPDF_UNICODE_ENABLED" true. That post suggests that dompdf 0.7.0 no longer relies on that configuration file. At this point I begin thinking that PHPWord's current version (which I'm using) which relies on dompdf has not been updated to support the current version of dompdf (which I'm using). I simply don't know.
My questions:
Can someone confirm if it's true that PHPWord's current version does not play well with dompdf's current version?
If the current version of both are supposed to work together, then what am I doing wrong and how do I fix it?
Thank you in advance for all of your help!
Note: I should note that I've included PHPWord and dompdf in my project via composer; so all relevant files are located in "/var/www/html/vendor" as one would expect. Also, I can't rely on TCPDF nor MPDF (which are alternate PDF rendering engines) because they generate files that don't meet the formatting needs I require for my project.

Parse error when creating menu item layout in Joomla 3

Specifically, the chapter is about creating a new menu layout and the example uses the registration form. Whenever I try to create a new menu item with the alternate registration form through the admin, I get the following error:
Warning: simplexml_load_file(): file:///C:/xampp/.../com_users/registration/approval.xml:23: parser error : error parsing attribute name in C:\xampp...\menutypes.php on line 395
I get this error and a few other similar ones, they all seem to blow up on line 395 of the mentioned file. That line is:
if ($xml = simplexml_load_file($file))
how can I fix this? Thanks!!
My wild guess is that you should be using a comparison operator instead of an assignment operator:
if ($xml == simplexml_load_file($file))

when using remapColumns in different event, sort icon doesn't show when clicking a header

I saved my column permutation info into a table. This information can be reloaded in beforeRequest event:
mynewperm = {....};
myGrid.jqGrid("remapColumns", mynewperm, true);
The columns are reordered correctly. However I lost the header icon. Now if I click any column header, I can not see
the sort icon anymore, then can not sort any column. How can I get it back?
Thank you,
yh
if you are able to change the code, you could test for an undefined of a.grid.headers[a.p.lastsort].
In the source file it could look like this:
// old
var previousSelectedTh = ts.grid.headers[ts.p.lastsort].el
// new:
var previousSelectedTh = ts.grid.headers[ts.p.lastsort] ? ts.grid.headers[ts.p.lastsort].el : null
Indeed if you look at the jquery.jqGrid.src.js source, the line is:
var previousSelectedTh = ts.grid.headers[ts.p.lastsort].el, newSelectedTh = ts.grid.headers[idxcol].el;
Line #1982 in my version. I fixed it by modifying the file and added this just before that line:
if (ts.p.lastsort < 0) // johnl.
ts.p.lastsort = 0;
The problem was that ts.p.lastsort was -1.
I've just managed to fix this issue myself but not using the methods described above. I was receiving the following error message when trying to sort columns in a jqgrid:
TypeError: a.grid.headers[a.p.lastsort] is undefined js/jqgrid/jquery.jqGrid.min.js?1.4:86
I should note that it was Firebug that produced this error message. Our company develops web applications for Chrome but Chrome's Javascript console produced a very uninformative error message:
Uncaught TypeError: Cannot read property 'el' of undefined
After stripping out all but the jqGrid declaration on the page causing the issue, it transpired that removing the "multiSelect" option declaration for the jqGrid solved the issue. Apparently, declaring this option causes an additional hidden column to be added into the grid rendered which enables users to select multiple grid rows at a time. I'm not exactly sure why this caused an issue but after consultation with the programming director here our best guess is that there is a for loop somewhere in the jqGrid library code which is called when column sorting is applied and the loop is not taking into account this extra column which results in it not being defined.
Strange answer to a strange issue but hopefully this will help somebody out in future and save them around 3 hours of debugging!
I've the same issue :
It append to me since i apply the "remapColumns" method in the "loadComplete" event (i get back user column configuration from a cookie).
So when I try to sort a column nothing happen. I got this error in firebug :
a.grid.headers[a.p.lastsort] is undefined -> jquery.jqGrid.min.js (line 93)
maybe it will be helpful to find what the problem is
Thank you

codeigniter error in page source view

I'm working with one array that have 55 elements inside and each one are another array with 17 elements each one.
When I show the array on the screen, nothing wrong happens but when I take a look in the page source, I have 55 x 17 "Severity: Notice" errors with the message "Undefined index".
Does someone know what can be wrong?
If the index really doesn't exist, I couldn't see the array on the screen.
I tested using if ( isset( ) ) { ... }, but still the same.
Codeigniter version: 1.7.2
Browsers tested: firefox, chrome, ie and safari.
I usually get this errors when I'm trying to echo something that is not defined. It's not an PHP error, only a notice. This is produced by the function error_reporting(); on the main index.php.
If you open this index.php file, you will see:
/*
|---------------------------------------------------------------
| PHP ERROR REPORTING LEVEL
|---------------------------------------------------------------
|
| By default CI runs with error reporting set to ALL. For security
| reasons you are encouraged to change this when your site goes live.
| For more info visit: http://www.php.net/error_reporting
|
*/
error_reporting(E_ALL);
You've two options:
Don't print a variable that is not defined.
Change the error_reporting(); with a non-notice prints. Like: error_reporting(E_ALL & ~E_NOTICE);.
Wish this helps you!
This has nothing to do with CI or your browser, it is a classic PHP notice.

Resources