SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 478 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

Along the same lines, we
can remove the extension from a filename; this also works with filenames and a path
to a file.
Utilities and Useful Classes
[ 352 ]
This example demonstrates how we can use these methods in conjunction with
one another:
if (JFile::getExt($filename) == 'txt')
{
echo JText::sprintf('%s is a text file',
JFile::stripExt($filename));
}
We will now venture into common file-system commands. We are provided with
four methods that deal explicitly with file management. The first of these is the
exists() method. This method returns a Boolean response and is used to check if a
file exists:
if (!JFile::exists($pathToFile))
{
// handle file does not exist
}
If a file exists then we can use any of the following methods to manage that file:
copy(), move(), and delete(). It's better to use these methods than to use the
normal PHP file-management functions because, if FTP is enabled, these methods
will attempt to use an FTP connection in priority to PHP functions. This decreases
the chance of error due to lack of user rights.


Pages:
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6