We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30319
    • 406 Posts
    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.
      • 30319
      • 406 Posts
      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??
        • 26931
        • 2,314 Posts
        Hi there,

        right now i’ve got the CssSwitcher working and it’s creating a html list perfectly, but i try to create buttons in order to increase or decrease the font size of a site, e.g.
        font size: [+] [-]

        is this possible with CssSwitcher? If not, does anyone know how to do this with MODx?

        thanks, jan
          • 21671
          • 244 Posts
          @sharkbait FWIW I used that functionality on http://www.smallfriendsnantucket.org I know it is not in the confines of css switcher, but if you peek at the code using firebug you can see how I did it. It is a quick little bit o’ jQuery and css to style the links. I hooked it to the main content area so that it would only resize that text. Most tutorials I saw were for three sizes of text. I wanted more flexibility than that because some people really need much bigger sizes so it will resize up or down infinitely, it also has a reset button.

          Cheers,

          Noah
            • 26931
            • 2,314 Posts
            @sharkbait FWIW I used that functionality on http://www.smallfriendsnantucket.org I know it is not in the confines of css switcher, but if you peek at the code using firebug you can see how I did it. It is a quick little bit o’ jQuery and css to style the links. I hooked it to the main content area so that it would only resize that text. Most tutorials I saw were for three sizes of text. I wanted more flexibility than that because some people really need much bigger sizes so it will resize up or down infinitely, it also has a reset button.
            hey Noah, thanks smiley ! i tried your script and it’s working nicely, do you know by any chance how to target all the text on a site with jQuery, or do i have to list all elements that i want to resize?
            ...also found this script -> http://simplersolutions.biz/content/font-resizer which sets a cookie, so that the selected font-size is kept while browsing the site

            thanks, j
              • 21671
              • 244 Posts
              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
                • 6179
                • 4 Posts
                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?