Hi, this is my problem...
I have this file with Geshi code
resaltarCodigo.php:
PHP Code:
<?php
require 'geshi/geshi.php'; /* Incluir la libreria del resaltador de sintaxis Geshi*/
/* Funcion que recibe un nombre de archivo para mostra resaltado su codigo, tambien recibe la extension
del archivo para determinar el lenguaje de programacion */
function mostrarCondigo($elArchivo,$tipo)
{ /* Inicio del cuerpo de la funcion*/
/*Podemos mostrar resaltado solamente un segmento de codigo, inicializando una variable con dicho codigo */
//$codigo="int number;
//bool yes;
//number=5;
//yes=true;";
$archivo = $elArchivo.".".$tipo; /*Indicar cual archivo abrir*/
$punteroArch = fopen($archivo,'r'); /*abrimos el archivo en lectura*/
$codigo = fread($punteroArch, filesize($archivo)); /* leemos el archivo */
$lenguaje=$tipo; /*Indicar el lenguaje de programacion a resaltar*/
$migeshi= & new GeSHi($codigo,$lenguaje);
$migeshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, true); /* Activar la numeracion de lineas */
$migeshi->set_line_style('background: yellow', 'background: #DFEEF3', true); /* cambiar estilo de numeros de lines*/
?>
<table width="100%%" align="center" cellpadding="0" cellspacing="0" bgcolor=#E8E8E8 border=0 bordercolor="#13bfff">
<tr><td align="center" bgcolor=#DFEEF3><b><font color="blue">Codigo <?php echo $tipo; ?></font></b></td></tr>
<tr><td><?php echo $migeshi->parse_code(); ?></td></tr>
</table>
<?php
fclose($punteroArch); /* Cerrar el archivo abierto */
} /* Fin del cuerpo de la funcion*/
?>
and in other file (
home.php) I use the function (from resaltarCodigo.php) here.
PHP Code:
require("resaltarCodigo.php"); /* Incluir la funcion para resaltar codigo */
mostrarCondigo("prog1","ASM"); /* Mandar a la funcion de resaltar el nombre del archivo y su tipo*/
echo "<br><br>";
mostrarCondigo("progc2","C"); /* Mandar a la funcion de resaltar el nombre del archivo y su tipo*/
I don't have problems in my localhost. my problem is here (in the server).
Can I use the functions fopen, fclose, fread in this server or not?
BUGS:
Warning: fopen(prog1.ASM) [function.fopen]: failed to open stream: No such file or directory in /home/a9262465/public_html/resaltarCodigo.php on line 14
Warning: filesize() [function.filesize]: stat failed for prog1.ASM in /home/a9262465/public_html/resaltarCodigo.php on line 16
Warning: fread(): supplied argument is not a valid stream resource in /home/a9262465/public_html/resaltarCodigo.php on line 16
Warning: fclose(): supplied argument is not a valid stream resource in /home/a9262465/public_html/resaltarCodigo.php on line 30
jajaj, my english is horrible. no?
but, please help me.
thanks