Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

  • Index
  •  » ClickCartPro 6
  •  » Is There Any Particular Reason For highlight_ Functions Not To Work?

#1 03-08-2011 02:12:19

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Is There Any Particular Reason For highlight_ Functions Not To Work?

I've been trying to get the  and  functions to work within the store and have discovered that they won't work. - The relevant handler has been added to Apache and the colour lines have been uncommented within the  file, but there is absolutely no way that either of those two functions will work.

Is this some kind of restriction in force within the cart software?

Offline

 

#2 03-08-2011 02:22:44

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

Re: Is There Any Particular Reason For highlight_ Functions Not To Work?

I have actually found a solution that works, from this site here:

http://perishablepress.com/press/2007/1 … -php-code/

The solution was to use the code shown below which, in turn, calls on the code that you need to display (after replacing the example_file with the required file name) - not what I would expect of PHP, but at least the call code is actually PHP and not Javascript sad

Code:

<?php 

function string_syntax_xhtml( $string, $return = false ) {
     $highlight = highlight_string( $string, true );
     $replace   = str_replace(
          array( '<font color="', '</font>' ),
          array( '<span style="color: ', '</span>' ),
          $highlight 
     );
     if( $return ) {
          return $replace;
     }
     echo $replace;
     return true;
}

function file_syntax_xhtml( $path, $return = false ) {
     return string_syntax_xhtml( file_get_contents( $path ), $return );
}

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title></title></head><body>';
string_syntax_xhtml( file_get_contents( 'file_example.php' ) );
echo '</body></html>';

?>

Another way round these problem functions can be found here:

http://softwaremaniacs.org/soft/highlight/en/

Last edited by Design_Wholesale (03-08-2011 02:23:42)

Offline

 
  • Index
  •  » ClickCartPro 6
  •  » Is There Any Particular Reason For highlight_ Functions Not To Work?

Board footer