Jump to content

dis

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dis's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The reason you are getting errors is because "$sql" doesn't exist inside the user::add function. You can send the $sql to the function via another variable: $addUser = $user->add($_POST['pseudonym'], $_POST['passkey'], $_POST['email'], $sql); OR You can set up the SQL class to have static functions and variables (requires PHP5). This means the SQL functions can be called statically and don't have to be instanced. example: class sql { private static $numQueries = 0; static public function query($sql){ self::$numQueries++; } } class user { $query = sql::query(""); }
  2. Hello there, I am using a preg_split to parse an XHTML document. I currently have: $parts = preg_split("~(<[^>]*>)~", $buffer, -1, PREG_SPLIT_DELIM_CAPTURE); This is working just fine, however... I don't want it to split elements inside a comment. Example: <link rel="stylesheet" type="text/css" href="css?assets/css/screen.css" media="screen" /> <!--[if IE]><link rel="stylesheet" type="text/css" href="css?assets/css/ie.css" media="screen" /><![endif]--> <link rel="stylesheet" type="text/css" href="css?assets/css/print.css" media="print" /> Currently it is returning: [0] => <link rel="stylesheet" type="text/css" href="css?assets/css/screen.css" media="screen" /> [1] => <!--[if IE]> [2] => <link rel="stylesheet" type="text/css" href="css?assets/css/ie.css" media="screen" /> [3] => <![endif]--> [4] => <link rel="stylesheet" type="text/css" href="css?assets/css/print.css" media="print" /> I want it, so it doesn't split any elements found inside the comments tags <!-- -->, so in turn it would return: [0] => <link rel="stylesheet" type="text/css" href="css?assets/css/screen.css" media="screen" /> [1] => <!--[if IE]><link rel="stylesheet" type="text/css" href="css?assets/css/ie.css" media="screen" /><![endif]--> [2] => <link rel="stylesheet" type="text/css" href="css?assets/css/print.css" media="print" /> Any help would be appreciated. Cheers, - dis.
  3. I find the exact same issue. However, I work around it. Best way, is to echo out a custom PHP file, for Firefox. If you want IE to show the same as Firefox, your file will need to be larger than 512 bytes. <?php header('HTTP/1.0 404 Not Found'); include(_DIR.'includes/404.php'); exit(); ?> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL '<strong><?php echo $_SERVER['REQUEST_URI']; ?></strong>' was not found on this server.</p> </body></html> <!-- - Unfortunately, Microsoft has added a clever new - "feature" to Internet Explorer. If the text of - an error's message is "too small", specifically - less than 512 bytes, Internet Explorer returns - its own error message. You can turn that off, - but it's pretty tricky to find switch called - "smart error messages". That means, of course, - that short error messages are censored by default. - IIS always returns error messages that are long - enough to make Internet Explorer happy. The - workaround is pretty simple: pad the error - message with a big comment like this to push it - over the five hundred and twelve bytes minimum. - Of course, that's exactly what you're reading - right now. -->
  4. Thanks alot joquius. Much appreciated!
  5. Sorry, it is sort of confusing. All I need to get is an array. I am not worrying about anything inside the "" at the moment, just the process of splitting up the original string. Basically I need to split the string by /. However, if / is located inside the quotes ="", I don't want it to split. Some further examples: <?php router::register('about/:title'); Array( [0] = about [1] = :title ) router::register('about/:title="/"'); Array( [0] = about [1] = :title="/" ) router::register('about/:title/:id="/^\d/"); Array( [0] = about [1] = :title [2] = :id="/^\d/" ) ?> Those above are the results I am looking for. If you need further explaination, please let me know.
  6. Hello, I currently have: <?php router::register('about/:id="/^\d/"/:title'); ?> I need to split the string by '/', unless '/' is found inside the ="" section. So, I need a function to split the above into an array which should match (hence why explode will not work): Array( [0] = about [1] = :id="/^\d/"; [2] = :title ) I can do this via array loops and strpos functions, but that seems slow and stupid. I am wondering if this can be done via a preg_match, returning matches. Any help would be fantastic. Cheers, - dis.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.