PHP error debug
Error: Function ereg() is deprecated
Error type/ Nr.: - 8192
File: \assets\snippets\cssSwitcher\classes\cssSwitcher.class.inc.php
Line: 86
Line 86 source: and ereg(’(.*)\.css$’, $filename, $regs) // filter for only css files
Trying to use this snippet causes the above error.
I will try to change it to use preg_match instead but I don’t know well enough how to change the regex part in the parentheses to work correctly, so I don’t know how well I can do this.
Maybe an experienced PHP programmer could review all the code to change ereg to preg_match code??
Thank you, Tom
P.S. This is with PHP 5.2.x on Xampp 1.7.1.
I eliminated the ereg / deprecated messages with the following statements:
if (is_file($modx->config[’base_path’].$this->config[’csspath’].$filename) // filter for only css
//and ereg(’(.*)\.css$’, $filename, $regs) // filter for only css files
and preg_match(’*.css*’, $filename, $regs) // new preg_match
//and !ereg(’^’.$this->config[’cssprintpre’], $filename) // filter for not printing sheet
and preg_match(’^’.$this->config[’cssprintpre’].’^’, $filename) // new preg_match
BUT now the snippet/code does not write out the correct default stylesheet name -- it writes null.css instead of style2.css in the header, where $defaultcss = style2 in the snippet call
and it does not display the list of styles AT ALL...
All help is much appreciated...
Thank you, Tom
P.S. Does anyone monitor this forum??
use the $(’body’) selector instead of $(’#content-main’) and it will open up the selection to the whole page.
Thanks for the link on the resizer too!
-Noah
I’ve got cssswitcher installed. It works when I use ’selectb’ and ’htmllist’, but when I use ’select’, I just get the list of files, but when selected, the sheet doesn’t change.
Where should I be looking to get this working?