Forums

if there is no attachment in the article

GreyHead 19 Feb, 2010
Hi freefall,

It will be something like this:

$file_1 = JRequest::getVar('file_1', '');
if ( $file_1 ) {
  $fulltext_template = str_replace('{file_1}', '<p><img style="max-width:500px;border:5px solid #eeeeee;" src="/components/com_chronocontact/uploads/showandtell/'.JRequest::getVar("file_1").'" target="_blank" ></p>', $fulltext_template);
} else {
  $fulltext_template = str_replace('{file_1}', '', $fulltext_template);
}
repeated for each file.

You could go further and check that the file exists too.

Bob
freefall 19 Feb, 2010
It Works like a charm!! Thank you! 😀
This topic is locked and no more replies can be posted.