Jump to content

jackpf

Members
  • Posts

    1,410
  • Joined

  • Last visited

    Never

Everything posted by jackpf

  1. You're right actually. Use the GET method instead.
  2. IE can't do anything. It's such a pain in the arse to code for.
  3. Ok ladies, a work around would be this: <?php echo '<a href="'.$_SERVER[php_SELF].'?function=1">Click here to call a function</a>'; if(isset($_GET['function'])) { foo(); } ?> I don't know about calling a function directly on click. You could try echo '<a href="#" onclick="'.foo().'">Function</a> but I don't know if it'll work. Hope that helps.
  4. Hmm...had a look. I've now got this- <?php function geshi_code($lang, $source) { include('geshi/geshi.php'); $path = 'geshi/geshi/'; $geshi = new GeSHi($source, $lang, $path); return $geshi->parse_code(); } function str_code($str) { $str = htmlspecialchars($str); $exist = '/\[somecode lang\=(.*?)\](.*?)\[\/somecode\]/is'; $replace = geshi_code("$1", "$2"); return preg_replace($exist, $replace, $str); } echo str_code("This is some code.[somecode lang=php]<?php $var = 'hello'; ?>[/somecode] end of code."); ?> But it returns this- This is some code. <?php $var = 'hello'; ?> end of code. Unhighlighted. In case you didn't know, geshi is a syntax highlighter. I don't understand why it's not working... Thanks anyway.
  5. <?php $str = $_POST['form']; $num_char = strlen($str); $num_char = $num_char - 1; for($counter =0; $counter <= $num_char; $counter++) { if($str[$counter] == $first || $str[$counter] == $second) { $error = 1; break;} $first = $str[$counter -2 ]; $second =$str[$counter -1 ]; } if($error) { echo 'Error, you are entering repeat characters.'; } ?> Hope this helps, Jack.
  6. Hi all, first post. Basically, my site has bbcode style regular expressions. However, I was wondering if there's a way to call a function on an extracted regular expression? For example, <?php function replacewithfunction($str) { $exist = '/\[code lang\=(.*?)\](.*?)\[\/code\]/is'; $replace = geshi_code($1, $2); $return = preg_replace($exist, $replace, $str); return $return; } ?> Where geshi_code() is the function I wish to call. Obviously this returns a syntax error, but this is basically what I want do. Any help would be much appreciated. Thanks, Jack.
×
×
  • 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.